From 4e2fc62ea0f3370ad86e0789783496667deaa298 Mon Sep 17 00:00:00 2001 From: Roosted7 <thomasroos@live.nl> Date: Thu, 5 Apr 2018 21:15:56 +0200 Subject: [PATCH] Extend submission api with more info about student --- zesje/resources/submissions.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zesje/resources/submissions.py b/zesje/resources/submissions.py index eadf5e82c..af9082877 100644 --- a/zesje/resources/submissions.py +++ b/zesje/resources/submissions.py @@ -36,14 +36,26 @@ class Submissions(Resource): raise orm.core.ObjectNotFound(Submission) return { 'id': s.copy_number, - 'studentID': s.student.id if s.student else None, + 'student': + { + 'id': s.student.id, + 'firstName': s.student.first_name, + 'lastName': s.student.last_name, + 'email': s.student.email + } if s.student else None, 'validated': s.signature_validated, } return [ { 'id': s.copy_number, - 'studentID': s.student.id if s.student else None, + 'student': + { + 'id': s.student.id, + 'firstName': s.student.first_name, + 'lastName': s.student.last_name, + 'email': s.student.email + } if s.student else None, 'validated': s.signature_validated, } for s in Submission.select(lambda s: s.exam == exam) -- GitLab