diff --git a/SE_API/TaskRoutes.py b/SE_API/TaskRoutes.py index 8ee4a93..d950433 100644 --- a/SE_API/TaskRoutes.py +++ b/SE_API/TaskRoutes.py @@ -887,6 +887,116 @@ def getUsersStateByTask(token, taskId): status=200, mimetype="application/json") +@task_routes.route('/api/tasks/isTaskSubmitted///', methods=["GET"]) +@auto.doc() +def isTaskSubmitted(token, taskId, groupId): + """ + >This Call will return an array of all of the User's Tasks +
+ Route Parameters
+ - SeToken: token
+
+
+ Payload
+ - NONE +
+
+ Response +
+ 200 - JSON Example:
+ [
+ {
+ "courseName": "Advance Math",
+ "courseId": 4762397176758272,
+ "PersonalTasks": [
+ {
+ "grade": 12,
+ "isPersonal": true,
+ "dueDate": {
+ "year": 2010,
+ "day": 4,
+ "month": 2
+ },
+ "courseId": 4762397176758272,
+ "title": "task1",
+ "description": "pls fddfsdfdsk",
+ "id": 5888297083600896
+ }
+ ],
+ "projectTasks": []
+ },
+ {
+ "courseName": "Bad Math",
+ "courseId": 5659598665023488,
+ "PersonalTasks": [
+ {
+ "grade": 12,
+ "isPersonal": true,
+ "dueDate": {
+ "year": 2010,
+ "day": 4,
+ "month": 2
+ },
+ "courseId": 5659598665023488,
+ "title": "new task1",
+ "description": "pls fddfsdfdsk",
+ "id": 5096648711602176
+ },
+ {
+ "grade": 12,
+ "isPersonal": true,
+ "dueDate": {
+ "year": 2010,
+ "day": 4,
+ "month": 2
+ },
+ "courseId": 5659598665023488,
+ "title": "new task4",
+ "description": "pls fddfsdfdsk",
+ "id": 5167017455779840
+ }
+ ],
+ "projectTasks": [
+ {
+ "grade": 12,
+ "isPersonal": false,
+ "dueDate": {
+ "year": 2010,
+ "day": 4,
+ "month": 2
+ },
+ "courseId": 5659598665023488,
+ "title": "new task3",
+ "description": "pls fddfsdfdsk",
+ "id": 5237386199957504
+ }
+ ]
+ }
+ ]
+
+
+ """ + user = get_user_by_token(token) + if user is None: + return bad_request("Bad User Token") + + task = Task.get_by_id(int(taskId)) + if task is None: + return bad_request("Bad task id") + + res = {} + + grade = TaskGrade.all().filter("taskId = ", task.key().id()).filter("userId = ", int(groupId)) + if grade.count() == 0: + res['submitted'] = False + else: + res['submitted'] = True + + + + return Response(response=res, + status=200, + mimetype="application/json") # @task_routes.route('/api/tasks/getAllUngradedTasks///', methods=["GET"]) # @auto.doc()