Fixed email_cc test

This commit is contained in:
NWalker4483 2021-07-22 15:08:28 -04:00
parent b94d49076d
commit 38b8c7fcdf
3 changed files with 15 additions and 5 deletions

View File

@ -394,7 +394,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Study"
/study/{study_id}/associates':
/study/{study_id}/associates:
parameters:
- name: study_id
in: path

View File

@ -122,14 +122,18 @@ class StudyService(object):
raise ApiError('uid not specified','A valid uva uid is required for this function')
if uid == study.user_uid:
return {'uid': ownerid, 'role': 'owner', 'send_email': True, 'access': True}
return {'uid': uid, 'role': 'owner', 'send_email': True, 'access': True}
person = db.session.query(StudyAssociated).filter((StudyAssociated.study_id == study_id)&(
StudyAssociated.uid == uid)).first()
if person:
return StudyAssociatedSchema().dump(person)
newAssociate = {'uid': person.uid}
newAssociate['role'] = person.role
newAssociate['send_email'] = person.send_email
newAssociate['access'] = person.access
return newAssociate
raise ApiError('uid_not_associated_with_study',"user id %s was not associated with study number %d"%(uid,
study_id))
@ -148,7 +152,13 @@ class StudyService(object):
people = db.session.query(StudyAssociated).filter(StudyAssociated.study_id == study_id)
people_list = [{'uid':ownerid,'role':'owner','send_email':True,'access':True}]
people_list += StudyAssociatedSchema().dump(people, many=True)
for person in people:
newAssociate = {'uid': person.uid}
newAssociate['role'] = person.role
newAssociate['send_email'] = person.send_email
newAssociate['access'] = person.access
people_list.append(newAssociate)
return people_list

View File

@ -765,7 +765,7 @@ class WorkflowService(object):
else:
if not hasattr(spiff_task.task_spec, 'lane') or spiff_task.task_spec.lane is None:
associated = StudyService.get_study_associates(processor.workflow_model.study.id)
return [user['uid'] for user in associated if user['access']]
return [user['uid'] for user in associated if user.get('access')]
if spiff_task.task_spec.lane not in spiff_task.data:
return [] # No users are assignable to the task at this moment
lane_users = spiff_task.data[spiff_task.task_spec.lane]