Skip to content

Commit

Permalink
Output obfuscated user name in Study CSV download API
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Feb 28, 2017
1 parent 3775c56 commit f821d4f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions server/api/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ def _getStudyCSVStream(self, study):
Study.getImages(study).sort('lowerName', SortDir.ASCENDING))

for annotatorUser, image in itertools.product(
Study.getAnnotators(study).sort('login', SortDir.ASCENDING),
images
sorted(
Study.getAnnotators(study),
key=lambda annotatorUser: User.obfuscatedName(annotatorUser)),
images
):
# this will iterate either 0 or 1 times
for annotation in Study.childAnnotations(
Expand All @@ -191,8 +193,12 @@ def _getStudyCSVStream(self, study):

filteredAnnotatorUser = User.filteredSummary(
annotatorUser, currentUser)
annotatorUserName = filteredAnnotatorUser.get(
'login', filteredAnnotatorUser['name'])
annotatorUserName = filteredAnnotatorUser['name']
if 'login' in filteredAnnotatorUser:
annotatorUserName += ' [%s %s (%s)]' % (
filteredAnnotatorUser['firstName'],
filteredAnnotatorUser['lastName'],
filteredAnnotatorUser['login'])

outDictBase = {
'study_name': study['name'],
Expand Down

0 comments on commit f821d4f

Please sign in to comment.