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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CSCE 361
scripts
Commits
e2c73166
Commit
e2c73166
authored
Sep 17, 2019
by
Christopher Bohn
Browse files
Options
Downloads
Patches
Plain Diff
Added multiton for CompositeUsers; added string representation code.
parent
da38c3cf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
canvas_classes.py
+9
-0
9 additions, 0 deletions
canvas_classes.py
composite_user.py
+24
-8
24 additions, 8 deletions
composite_user.py
with
33 additions
and
8 deletions
canvas_classes.py
+
9
−
0
View file @
e2c73166
...
...
@@ -120,6 +120,9 @@ class GroupSet: # aka, group_category
groups
.
append
(
Group
(
canvas_group
))
return
groups
def
__repr__
(
self
):
return
self
.
get_name
()
"""
{
...
...
@@ -187,6 +190,9 @@ class Group:
def
add_student
(
self
,
user
):
self
.
canvas_group
.
create_membership
(
user
.
get_canvas_id
())
def
__repr__
(
self
):
return
self
.
get_name
()
"""
{
...
...
@@ -289,6 +295,9 @@ class Course:
group_category
=
self
.
canvas_course
.
create_group_category
(
groupset_name
)
return
GroupSet
(
group_category
)
def
__repr__
(
self
):
return
f
'
{
self
.
canvas_course
.
course_code
}
:
{
self
.
canvas_course
.
name
}
'
"""
{
...
...
This diff is collapsed.
Click to expand it.
composite_user.py
+
24
−
8
View file @
e2c73166
...
...
@@ -6,6 +6,8 @@ NO_PARTNERING_LIST_MAXIMUM = 10
class
CompositeUser
:
instances
=
{}
def
__init__
(
self
,
student_dictionary
,
graylist
,
blacklist
):
self
.
canvas_user
=
None
self
.
gitlab_user
=
None
...
...
@@ -19,6 +21,10 @@ class CompositeUser:
self
.
graylist
=
set
(
graylist
)
self
.
blacklist
=
set
(
blacklist
)
self
.
candidate_teammates
=
None
CompositeUser
.
instances
[
self
.
canvas_email
]
=
self
CompositeUser
.
instances
[
self
.
gitlab_email
]
=
self
CompositeUser
.
instances
[
self
.
canvas_username
]
=
self
CompositeUser
.
instances
[
self
.
gitlab_username
]
=
self
def
get_canvas_user
(
self
):
if
self
.
canvas_user
is
None
:
...
...
@@ -42,6 +48,16 @@ class CompositeUser:
def
discard_team
(
self
):
self
.
candidate_teammates
=
None
def
__repr__
(
self
):
if
self
.
canvas_email
==
self
.
gitlab_email
:
return
f
'
{
self
.
readable_name
}
<
{
self
.
canvas_email
}
>
'
else
:
return
f
'
{
self
.
readable_name
}
<
{
self
.
canvas_email
}
> <
{
self
.
gitlab_email
}
>
'
@staticmethod
def
get_user
(
username_or_email
):
return
CompositeUser
.
instances
[
username_or_email
]
@staticmethod
def
read_student_csv
(
filename
):
students
=
set
()
...
...
@@ -83,16 +99,16 @@ class CompositeUser:
'
GitlabEmail
'
:
student
.
gitlab_email
}
count
=
0
for
former_partner
in
student
.
graylist
:
student_dictionary
.
update
({
f
'
Graylist
{
count
}
'
:
former_partner
})
count
+=
1
while
count
<
NO_PARTNERING_LIST_MAXIMUM
:
student_dictionary
.
update
({
f
'
Graylist
{
count
}
'
:
''
})
student_dictionary
[
f
'
Graylist
{
count
}
'
]
=
former_partner
count
+=
1
# while count < NO_PARTNERING_LIST_MAXIMUM:
# student_dictionary.update({f'Graylist{count}': ''})
# count += 1
count
=
0
for
undesired_partner
in
student
.
blacklist
:
student_dictionary
.
update
({
f
'
Blacklist
{
count
}
'
:
undesired_partner
})
count
+=
1
while
count
<
NO_PARTNERING_LIST_MAXIMUM
:
student_dictionary
.
update
({
f
'
Blacklist
{
count
}
'
:
''
})
student_dictionary
[
f
'
Blacklist
{
count
}
'
]
=
undesired_partner
count
+=
1
# while count < NO_PARTNERING_LIST_MAXIMUM:
# student_dictionary.update({f'Blacklist{count}': ''})
# count += 1
writer
.
writerow
(
student_dictionary
)
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