Prevents duplication of study on update.

This commit is contained in:
Aaron Louie 2020-02-21 11:24:51 -05:00
parent eb6354db6e
commit 443d38a9a1

View File

@ -35,7 +35,7 @@ def update_study(study_id, body):
error = ApiError('unknown_study', 'The study "' + study_id + '" is not recognized.')
return ApiErrorSchema.dump(error), 404
study = StudyModelSchema().load(body, session=session)
study = StudyModelSchema().load(body, session=session, instance=study)
session.add(study)
session.commit()
return StudyModelSchema().dump(study)