From b79359e54358f77b46686c03e43dcc609e5c9e47 Mon Sep 17 00:00:00 2001
From: Roosted7 <thomasroos@live.nl>
Date: Thu, 19 Apr 2018 22:08:36 +0200
Subject: [PATCH] Rename solutions and remarks of submission in api

---
 zesje/resources/exams.py       |  6 +++---
 zesje/resources/submissions.py | 18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/zesje/resources/exams.py b/zesje/resources/exams.py
index 080c5bbb6..10e5fad8e 100644
--- a/zesje/resources/exams.py
+++ b/zesje/resources/exams.py
@@ -54,16 +54,16 @@ class ExamConfig(Resource):
                             'email': sub.student.email
                         } if sub.student else None,
                     'validated': sub.signature_validated,
-                    'solutions':
+                    'problems':
                     [
                         {
-                            'problem': sol.problem.id,
+                            'id': sol.problem.id,
                             'graded_by': sol.graded_by,
                             'graded_at': sol.graded_at.isoformat() if sol.graded_at else None,
                             'feedback': [
                                 fb.id for fb in sol.feedback
                             ],
-                            'remarks': sol.remarks
+                            'remark': sol.remarks
                         } for sol in sub.solutions.order_by(lambda s: s.problem.id)
                     ]
                 } for sub in exam.submissions.order_by(lambda s: s.copy_number)
diff --git a/zesje/resources/submissions.py b/zesje/resources/submissions.py
index 9b44ab137..7c9e929dc 100644
--- a/zesje/resources/submissions.py
+++ b/zesje/resources/submissions.py
@@ -44,16 +44,16 @@ class Submissions(Resource):
                         'email': sub.student.email
                     } if sub.student else None,
                 'validated': sub.signature_validated,
-                'solutions':
+                'problems':
                 [
                     {
-                        'problem': sol.problem.id,
+                        'id': sol.problem.id,
                         'graded_by': sol.graded_by,
                         'graded_at': sol.graded_at.isoformat() if sol.graded_at else None,
                         'feedback': [
                             fb.id for fb in sol.feedback
                         ],
-                        'remarks': sol.remarks
+                        'remark': sol.remarks
                     } for sol in sub.solutions.order_by(lambda s: s.problem.id)
                 ]
             }
@@ -69,16 +69,16 @@ class Submissions(Resource):
                         'email': sub.student.email
                     } if sub.student else None,
                 'validated': sub.signature_validated,
-                'solutions':
+                'problems':
                 [
                     {
-                        'problem': sol.problem.id,
+                        'id': sol.problem.id,
                         'graded_by': sol.graded_by,
                         'graded_at': sol.graded_at.isoformat() if sol.graded_at else None,
                         'feedback': [
                             fb.id for fb in sol.feedback
                         ],
-                        'remarks': sol.remarks
+                        'remark': sol.remarks
                     } for sol in sub.solutions.order_by(lambda s: s.problem.id)
                 ]
             } for sub in Submission.select(lambda s: s.exam == exam).order_by(lambda s: s.copy_number)
@@ -134,16 +134,16 @@ class Submissions(Resource):
                     'email': sub.student.email
                 } if sub.student else None,
             'validated': sub.signature_validated,
-            'solutions':
+            'problems':
             [
                 {
-                    'problem': sol.problem.id,
+                    'id': sol.problem.id,
                     'graded_by': sol.graded_by,
                     'graded_at': sol.graded_at.isoformat() if sol.graded_at else None,
                     'feedback': [
                         fb.id for fb in sol.feedback
                     ],
-                    'remarks': sol.remarks
+                    'remark': sol.remarks
                 } for sol in sub.solutions.order_by(lambda s: s.problem.id)
             ]
         }
-- 
GitLab