fix in submitGrade
This commit is contained in:
parent
35ecdd1f60
commit
043fb67b5a
1 changed files with 3 additions and 1 deletions
|
@ -304,12 +304,14 @@ def submitGrade(token, taskId, ownerId, grade):
|
||||||
tg = TaskGrade.all().filter("taskId = ", int(taskId)).filter("userId = ", int(ownerId))
|
tg = TaskGrade.all().filter("taskId = ", int(taskId)).filter("userId = ", int(ownerId))
|
||||||
if tg.count() == 0:
|
if tg.count() == 0:
|
||||||
grade = TaskGrade(taskId=int(taskId), userId=int(ownerId), grade=int(grade))
|
grade = TaskGrade(taskId=int(taskId), userId=int(ownerId), grade=int(grade))
|
||||||
|
db.put(grade)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for g in tg.run():
|
for g in tg.run():
|
||||||
g.grade=int(grade)
|
g.grade=int(grade)
|
||||||
g.taskId=int(taskId)
|
g.taskId=int(taskId)
|
||||||
g.userId=int(ownerId)
|
g.userId=int(ownerId)
|
||||||
db.put(grade)
|
db.put(g)
|
||||||
db.save
|
db.save
|
||||||
return Response(response=grade.to_JSON(),
|
return Response(response=grade.to_JSON(),
|
||||||
status=200,
|
status=200,
|
||||||
|
|
Loading…
Reference in a new issue