Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pvk-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
amiv
pvk-tool
Commits
c236c86e
Commit
c236c86e
authored
Dec 06, 2017
by
Alexander Dietmüller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify need of get_id in hook.
parent
51789a43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Backend/signups.py
Backend/signups.py
+6
-2
No files found.
Backend/signups.py
View file @
c236c86e
...
...
@@ -37,11 +37,15 @@ def wrap_response(function):
@
wrap_response
def
new_signups
(
signups
):
"""Update the status for all signups to a course."""
# Remove duplicates by using a set
def
get_id
(
course
):
"""If item has an _id, return it. Otherwise item will be the _id."""
"""Return the course id, necessary to cope with embedding.
If the client requests `course` to be embedded, it will be a dict
with the id as key. Otherwise `course` will be just the id.
"""
return
course
[
'_id'
]
if
isinstance
(
course
,
dict
)
else
course
# Remove duplicates by using a set
courses
=
set
(
get_id
(
item
[
'course'
])
for
item
in
signups
)
# Re-format signups into a dict so we can update them easier later
signups_by_id
=
{
str
(
item
[
'_id'
]):
item
for
item
in
signups
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment