Skip to content
Snippets Groups Projects

Toggling pregrading and Identifying blank solutions

Open Ghost User requested to merge feature/toggle-pregrading into develop
Compare and Show latest version
3 files
+ 17
30
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 6
7
@@ -90,7 +90,7 @@ class Problems(Resource):
def put(self, problem_id):
"""PUT to a problem
This method accepts any of the legible arguments passed to it.
This method accepts both the problem name and the grading policy.
problem_id: int
the problem id to put to
@@ -98,20 +98,19 @@ class Problems(Resource):
the attribute (or property) to put to
Returns
HTTP 200 on succes, 404 if problem is invalid
HTTP 200 on success, 404 if problem is invalid
"""
args = self.put_parser.parse_args()
problem = Problem.query.get(problem_id)
if problem is None:
msg = f"Problem with id {problem_id} doesn't exist"
return dict(status=404, message=msg), 404
return dict(status=404, message=f"Problem with id {problem_id} doesn't exist"), 404
for key in args.keys():
value = args[key]
for attr, value in args.items():
if value is not None:
setattr(problem, key, value)
setattr(problem, attr, value)
db.session.commit()
Loading