diff --git a/SE_API/TaskRoutes.py b/SE_API/TaskRoutes.py index 0725bfd..386b902 100644 --- a/SE_API/TaskRoutes.py +++ b/SE_API/TaskRoutes.py @@ -335,7 +335,7 @@ def getAllFutureTasks(token): for t in query.run(): taskDic =dict(json.loads(t.to_JSON())) #add a key 'forSortDate' for sorting dates - taskTime = datetime.datetime(taskDic['dueDate']['year'], taskDic['dueDate']['month'], taskDic['dueDate']['day']) + taskTime = datetime.date(taskDic['dueDate']['year'], taskDic['dueDate']['month'], taskDic['dueDate']['day']) if taskTime >= datetime.date.today(): taskDic['forSortDate'] = taskTime arr.append(taskDic) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index c147948..d269bdd 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -79,6 +79,33 @@ angular.module('SeHub') $scope.msg.msgToAdd = null; } + $scope.gotoTask = function(task) + { + console.log(task); + if(task.isPersonal) + { + $location.path('/tasks/fill/' + task.id + '/' + $scope.user.id); + } + else // it's a project task + { + apiService.getProjectsByCourse(token, task.courseId).success(function(data) + { + console.log($scope.user); + 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]) + { + $location.path('/tasks/fill/' + task.id + '/' + data[j].id); + } + } + }).error(function(err) + { + console.log(err.message); + }); + } + } + $scope.displayTasks = function() { apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK @@ -89,15 +116,17 @@ angular.module('SeHub') { console.log(err.message); }); + } - // apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId - // { - // console.log("YE"); - // }).error(function(err) - // { - // console.log("Error: " + err.message); - // }); - + $scope.getProjects = function(courseId) + { + apiService.getProjectsByCourse(token, courseId).success(function(data) + { + return data; + }).error(function(err) + { + console.log(err.message); + }); } $scope.getCampuses = function() @@ -106,7 +135,7 @@ angular.module('SeHub') { $scope.campuses = data; $scope.getCourses(); // Get all the courses info - if($scope.messages) + if($scope.userMessages) { //$scope.displayMessages(); // // Display all messages in message feed and the latest one } @@ -158,25 +187,6 @@ angular.module('SeHub') console.log($scope.courseObj); } - // $scope.chooseCourseClicked = function() - // { - // console.log("Click "); - // console.log($scope.choosenCourse); - // if($scope.choosenCourse) - // { - // console.log("here"); - // $scope.courseObj = null; - // for(var i = 0; i < $scope.courses.length; i++) - // { - // if($scope.courses[i].courseName === $scope.choosenCourse) - // { - // $scope.courseObj = $scope.courses[i]; - // console.log($scope.courseObj); - // } - // } - // } - // } - $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); @@ -185,8 +195,13 @@ angular.module('SeHub') $scope.getCampuses(); // Get all the campuses info // animation - $scope.displayMessages(); + if($scope.userMessages) + { + $scope.displayMessages(); // // Display all messages in message feed and the latest one + } + // $scope.displayMessages(); $scope.displayTasks(); // Display all tasks in task feed and the latest one + // $scope.getProjects(); // Get all projects info $scope.isEnterd = top.setIsEnterd; }]); \ No newline at end of file diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js index cd4c459..1642c3b 100644 --- a/templates/js/controllers/tasksController.js +++ b/templates/js/controllers/tasksController.js @@ -1,14 +1,32 @@ angular.module('SeHub') .controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { - console.log("in controller"); + $scope.lecturerTasks = []; + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; $scope.createTaskClicked = function() { $location.path("/tasks/new"); // Reference to 'newTask' page } + $scope.displayTasks = function() + { + apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK + { + $scope.lecturerTasks = data; + console.log(data); + }).error(function(err) + { + console.log(err.message); + }); + } + $scope.gotoTask = function(taskId) + { + $location.path('/tasks/fill/' + taskId); + } + $scope.displayTasks(); // Calling tasks with task id }]); \ No newline at end of file diff --git a/templates/views/home.html b/templates/views/home.html index 83b9b31..5708eef 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -31,7 +31,9 @@ Closest Task-
- In Course: {{userTasks[0].courseName}} + + {{userTasks[0].title}} +
@@ -93,7 +95,6 @@
{{msg.group.courseName}} -

{{msg.group.projectName}}
@@ -130,14 +131,16 @@ -

Tasks

- +
- {{task.courseName}} + Title: + + {{task.title}} + +

+ Description: {{task.description}}
-
- - +
diff --git a/templates/views/tasks.html b/templates/views/tasks.html index 2279260..a405511 100644 --- a/templates/views/tasks.html +++ b/templates/views/tasks.html @@ -24,8 +24,13 @@ -

Not Submitted

-

Not Submitted ..

+ + + {{task.title}} + + + +