Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CSCE 361
scripts
Commits
deff2805
Commit
deff2805
authored
4 years ago
by
Christopher Bohn
Browse files
Options
Downloads
Patches
Plain Diff
Handled edge case of student excused from project used for code review
parent
58cbe2a8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
prep-code-review-and-response.py
+30
-26
30 additions, 26 deletions
prep-code-review-and-response.py
prep_assignment.py
+3
-2
3 additions, 2 deletions
prep_assignment.py
with
33 additions
and
28 deletions
prep-code-review-and-response.py
+
30
−
26
View file @
deff2805
...
@@ -73,33 +73,37 @@ def validate_forks():
...
@@ -73,33 +73,37 @@ def validate_forks():
new_groups
:
List
[
CanvasUserGroup
]
=
list
(
filter
(
lambda
g
:
g
.
get_name
()
==
new_groupset
,
new_groups
:
List
[
CanvasUserGroup
]
=
list
(
filter
(
lambda
g
:
g
.
get_name
()
==
new_groupset
,
course
.
get_user_groupsets
()))[
0
].
get_groups
()
course
.
get_user_groupsets
()))[
0
].
get_groups
()
for
student
in
sorted
(
students
,
key
=
lambda
s
:
s
.
get_canvas_user
().
get_sortable_name
()):
for
student
in
sorted
(
students
,
key
=
lambda
s
:
s
.
get_canvas_user
().
get_sortable_name
()):
print
(
f
'
Validating
{
student
.
get_canvas_user
().
get_name
()
}
'
)
student_canvas_name
=
student
.
get_canvas_user
().
get_name
()
old_group_name
:
str
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
print
(
f
'
Validating
{
student_canvas_name
}
'
)
old_groups
))[
0
].
get_name
().
strip
().
replace
(
"
"
,
""
)
old_group_name_list
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
old_groups
))
if
len
(
old_group_name_list
)
>
0
:
old_group_name
:
str
=
old_group_name_list
[
0
].
get_name
().
strip
().
replace
(
"
"
,
""
)
new_group
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
new_groups
))[
0
]
new_group
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
new_groups
))[
0
]
projects
:
List
[
GitlabProject
]
=
student
.
get_gitlab_user
().
get_projects
()
projects
:
List
[
GitlabProject
]
=
student
.
get_gitlab_user
().
get_projects
()
project_names
:
List
[
str
]
=
list
(
map
(
lambda
p
:
p
.
get_name
(),
projects
))
project_names
:
List
[
str
]
=
list
(
map
(
lambda
p
:
p
.
get_name
(),
projects
))
if
old_group_name
in
project_names
:
if
old_group_name
in
project_names
:
project
:
GitlabProject
=
list
(
filter
(
lambda
p
:
p
.
get_name
()
==
old_group_name
,
projects
))[
0
]
project
:
GitlabProject
=
list
(
filter
(
lambda
p
:
p
.
get_name
()
==
old_group_name
,
projects
))[
0
]
if
project
.
get_visibility
()
!=
'
private
'
:
if
project
.
get_visibility
()
!=
'
private
'
:
print
(
f
'
\t
{
student
.
get
_canvas_
user
().
get_
name
()
}
has not set
{
old_group_name
}
.git to
"
private
"
'
print
(
f
'
\t
{
student_canvas_name
}
has not set
{
old_group_name
}
.git to
"
private
"
'
f
'
(access level is
{
project
.
get_visibility
()
}
).
'
)
f
'
(access level is
{
project
.
get_visibility
()
}
).
'
)
users
:
List
[
GitlabUser
]
=
project
.
get_all_users
()
users
:
List
[
GitlabUser
]
=
project
.
get_all_users
()
usernames
:
List
[
str
]
=
list
(
map
(
lambda
u
:
u
.
get_username
(),
users
))
usernames
:
List
[
str
]
=
list
(
map
(
lambda
u
:
u
.
get_username
(),
users
))
for
TA
in
TAs
:
for
TA
in
TAs
:
if
TA
not
in
usernames
:
if
TA
not
in
usernames
:
print
(
f
'
\t
{
student
.
get
_canvas_
user
().
get_
name
()
}
did not add @
{
TA
}
to repo.
'
)
print
(
f
'
\t
{
student_canvas_name
}
did not add @
{
TA
}
to repo.
'
)
for
partner
in
new_group
.
get_students
():
for
partner
in
new_group
.
get_students
():
composite_student
:
CompositeUser
=
list
(
filter
(
lambda
s
:
s
.
get_canvas_user
()
==
partner
,
students
))[
0
]
composite_student
:
CompositeUser
=
list
(
filter
(
lambda
s
:
s
.
get_canvas_user
()
==
partner
,
students
))[
0
]
if
composite_student
.
get_gitlab_user
().
get_username
()
not
in
usernames
:
if
composite_student
.
get_gitlab_user
().
get_username
()
not
in
usernames
:
print
(
f
'
\t
{
student
.
get
_canvas_
user
().
get_
name
()
}
did not add
{
partner
.
get_name
()
}
to repo.
'
)
print
(
f
'
\t
{
student_canvas_name
}
did not add
{
partner
.
get_name
()
}
to repo.
'
)
else
:
else
:
print
(
f
'
\t
{
student
.
get
_canvas_
user
().
get_
name
()
}
: Could not locate
{
old_group_name
}
.git
'
)
print
(
f
'
\t
{
student_canvas_name
}
: Could not locate
{
old_group_name
}
.git
'
)
print
(
'
\t\t
This may be because the student hasn
\'
t forked their repository, or
'
)
print
(
'
\t\t
This may be because the student hasn
\'
t forked their repository, or
'
)
print
(
'
\t\t
because they haven
\'
t given you access, or because they renamed it.
'
)
print
(
'
\t\t
because they haven
\'
t given you access, or because they renamed it.
'
)
print
(
f
'
\t\t\t
{
student
.
get
_canvas_
user
().
get_
name
()
}
\'
s repositories:
'
)
print
(
f
'
\t\t\t
{
student_canvas_name
}
\'
s repositories:
'
)
for
project
in
project_names
:
for
project
in
project_names
:
print
(
f
'
\t\t\t
{
project
}
'
)
print
(
f
'
\t\t\t
{
project
}
'
)
else
:
print
(
f
'
\t
{
student_canvas_name
}
does not have an old Canvas group.
'
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
prep_assignment.py
+
3
−
2
View file @
deff2805
...
@@ -140,8 +140,9 @@ def create_pairs(students: Set[CompositeUser], groupset_name: str = 'Unknown Ass
...
@@ -140,8 +140,9 @@ def create_pairs(students: Set[CompositeUser], groupset_name: str = 'Unknown Ass
print
(
'
Next we shall assign partners to students with blacklists.
'
)
print
(
'
Next we shall assign partners to students with blacklists.
'
)
else
:
else
:
print
(
'
There are no students with blacklists.
'
)
print
(
'
There are no students with blacklists.
'
)
for
student
in
students_with_blacklist
:
for
student
in
students_with_blacklist
:
# TODO: there's a bug here when students with blacklists make requests
pair_number
+=
1
pair_number
+=
1
if
student
in
unassigned_students
:
# TODO: can probably fix bug by putting ALL the code under this "if"
unassigned_students
.
remove
(
student
)
unassigned_students
.
remove
(
student
)
potential_partner
:
CompositeUser
=
random
.
choice
(
tuple
(
unassigned_students
))
potential_partner
:
CompositeUser
=
random
.
choice
(
tuple
(
unassigned_students
))
while
not
(
student
.
is_blacklist_compatible
(
potential_partner
)
and
while
not
(
student
.
is_blacklist_compatible
(
potential_partner
)
and
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment