Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def unreject_assignment(self, assignment_id, all_studies=False):
''' Unreject assignment '''
response = self.amt_services.unreject_assignment(assignment_id)
result = {}
if not response.success:
raise response.exception
else:
message='unrejected {}'.format(assignment_id)
try:
participant = Participant.query\
.filter(Participant.assignmentid == assignment_id)\
.order_by(Participant.beginhit.desc()).first()
participant.status = CREDITED
db_session.add(participant)
db_session.commit()
except:
message = '{} but failed to update local db'.format(
message)
return message