From e9845d29b6bc14ae170c212b4d9ca19738b0ad28 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Mon, 3 Aug 2015 02:42:24 +0300 Subject: [PATCH 1/2] - in progress --- SE_API/TaskRoutes.py | 7 +++--- templates/js/controllers/homeController.js | 15 +++++++++++- templates/js/controllers/taskController.js | 3 +++ templates/js/services/apiService.js | 8 +++++++ templates/views/home.html | 28 ++++++++++++++-------- 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/SE_API/TaskRoutes.py b/SE_API/TaskRoutes.py index 72dcff5..451826e 100644 --- a/SE_API/TaskRoutes.py +++ b/SE_API/TaskRoutes.py @@ -703,9 +703,9 @@ def getAllUserTasks(token): taskDic['forSortDate'] = taskTime - if t.isPersonal: - ownerId = user.key().id() - else: + + ownerId = user.key().id() + if not t.isPersonal: project = Project.all().filter("courseId = ", course.key().id()) for p in project.run(): if str(p.key().id()) in user.projects_id_list: @@ -1111,6 +1111,7 @@ def getAllUnsubmittedTasks(token): taskDic['isPersonal'] = task.isPersonal taskDic['usersToReview'] = [] taskDic['projectsToReview'] = [] + taskDic['id'] = task.key().id() tgs = TaskGrade.all().filter("taskId = ", task.key().id()) tcs = TaskComponent.all().filter("taskId = ", task.key().id()).filter("order = ", 0).filter("userId != ", -1) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 6582e2e..eb50835 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -7,6 +7,7 @@ angular.module('SeHub') $scope.oldText = ""; $scope.messages = []; $scope.userMessages = []; + $scope.unSubmittedTasks = []; $scope.userTasks = []; $scope.messagesDisplay = []; $scope.courses = []; @@ -69,6 +70,7 @@ angular.module('SeHub') $scope.reviewTask = function(task) { //tasks/overview/:taskId/:submitterId/:gId', { + if(task.isPersonal) // As Lecturer { $location.path('/tasks/overview/' + task.id + '/' + $scope.user.id + '/' + $scope.user.id); @@ -118,7 +120,6 @@ angular.module('SeHub') apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK { $scope.userTasks = data; - console.log($scope.userTasks); }).error(function(err) { console.log(err.message); @@ -193,6 +194,8 @@ angular.module('SeHub') console.log($scope.courseObj); } + + $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); @@ -205,6 +208,16 @@ angular.module('SeHub') { $scope.displayMessages(); // // Display all messages in message feed and the latest one } + + apiService.getAllUnsubmittedTasks(token).success(function(data) + { + console.log(data); + $scope.unSubmittedTasks = data; + }).error(function(err) + { + console.log(err.message); + }); + // $scope.displayMessages(); $scope.displayTasks(); // Display all tasks in task feed and the latest one // $scope.getProjects(); // Get all projects info diff --git a/templates/js/controllers/taskController.js b/templates/js/controllers/taskController.js index 3304eab..2529acf 100644 --- a/templates/js/controllers/taskController.js +++ b/templates/js/controllers/taskController.js @@ -101,6 +101,9 @@ angular.module('SeHub') $location.path('/tasks/overview/' + taskId + '/' + groupId + '/' + groupId); }); + }).error(function(err) + { + console.log(err.message); }) } else { diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 6e064d2..0a1ac96 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -117,6 +117,14 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getAllUnsubmittedTasks: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllUnsubmittedTasks/" + token; + req = { + method : "GET", + url : url + }; + return $http(req); + }, getAllFutureTasks: function(token, courseId){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token + "/" + courseId; req = { diff --git a/templates/views/home.html b/templates/views/home.html index 24618b9..472d6f7 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -81,16 +81,24 @@ - -
- Title: - - {{task.title}} - -

- Description: {{task.description}} -
-
+
+ +
+ Title: {{task.title}} +

+ + Name: {{uName.name}} + +
+
+ Title: {{task.title}} +

+ + Name: {{projName.projectName}} + +
+
+
From 50085172a98401eb408d7a7136c980feca96ccc4 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Mon, 3 Aug 2015 02:55:00 +0300 Subject: [PATCH 2/2] - finish --- templates/js/controllers/homeController.js | 36 +++++++++++----------- templates/views/home.html | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index eb50835..eabc663 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -67,27 +67,27 @@ angular.module('SeHub') $scope.msg.msgToAdd = null; } - $scope.reviewTask = function(task) + $scope.reviewTask = function(taskId, groupId) { //tasks/overview/:taskId/:submitterId/:gId', { - if(task.isPersonal) // As Lecturer - { - $location.path('/tasks/overview/' + task.id + '/' + $scope.user.id + '/' + $scope.user.id); - } - else // it's a project task - { - apiService.getProjectsByCourse(token, task.courseId).success(function(data) - { - for(var i = 0; i < $scope.user.projects_id_list.length; i++) - for(var j = 0; j < data.length; j++) - if($scope.user.projects_id_list[i] === data[j].id.toString()) - $location.path('/tasks/overview/' + task.id + '/' + data[j].id + '/' + data[j].id); - }).error(function(err) - { - console.log(err.message); - }); - } + // if(task.isPersonal) // As Lecturer + // { + $location.path('/tasks/overview/' + taskId + '/' + groupId + '/' + groupId); + // } + // else // it's a project task + // { + // apiService.getProjectsByCourse(token, task.courseId).success(function(data) + // { + // for(var i = 0; i < $scope.user.projects_id_list.length; i++) + // for(var j = 0; j < data.length; j++) + // if($scope.user.projects_id_list[i] === data[j].id.toString()) + // $location.path('/tasks/overview/' + task.id + '/' + data[j].id + '/' + data[j].id); + // }).error(function(err) + // { + // console.log(err.message); + // }); + // } } $scope.gotoTask = function(task) diff --git a/templates/views/home.html b/templates/views/home.html index 472d6f7..a59b40d 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -86,14 +86,14 @@
Title: {{task.title}}

- + Name: {{uName.name}}
Title: {{task.title}}

- + Name: {{projName.projectName}}