- tasks - fixed
This commit is contained in:
parent
f330e3a3fb
commit
965e6949e7
5 changed files with 82 additions and 41 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
}]);
|
|
@ -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
|
||||
|
||||
|
||||
}]);
|
|
@ -31,7 +31,9 @@
|
|||
Closest Task-
|
||||
<md-card layout-margin layout-padding>
|
||||
<div>
|
||||
In Course: {{userTasks[0].courseName}}
|
||||
<md-button ng-click="gotoTask(task)">
|
||||
{{userTasks[0].title}}
|
||||
</md-button>
|
||||
</div>
|
||||
</md-card>
|
||||
</div>
|
||||
|
@ -93,7 +95,6 @@
|
|||
</div>
|
||||
<div>
|
||||
{{msg.group.courseName}}
|
||||
<br></br>
|
||||
{{msg.group.projectName}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -130,14 +131,16 @@
|
|||
|
||||
<md-tab label="Tasks">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Tasks</h1>
|
||||
<md-card ng-repeat = "task in userTasks">
|
||||
<md-card ng-repeat = "task in userTasks" layout-padding>
|
||||
<div>
|
||||
{{task.courseName}}
|
||||
Title:
|
||||
<md-button ng-click="gotoTask(task)">
|
||||
{{task.title}}
|
||||
</md-button>
|
||||
<br></br>
|
||||
Description: {{task.description}}
|
||||
</div>
|
||||
</md-card>
|
||||
|
||||
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<md-tab label="two">
|
||||
|
|
|
@ -24,8 +24,13 @@
|
|||
</md-tab>
|
||||
<md-tab label="Not Submitted">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Not Submitted</h1>
|
||||
<p> Not Submitted ..</p>
|
||||
<md-card ng-repeat = "task in lecturerTasks">
|
||||
<md-button ng-click="gotoTask(task.id)">
|
||||
{{task.title}}
|
||||
</md-button>
|
||||
|
||||
</md-card>
|
||||
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<div ng-if = "user.isLecturer">
|
||||
|
|
Loading…
Reference in a new issue