- 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():
|
for t in query.run():
|
||||||
taskDic =dict(json.loads(t.to_JSON()))
|
taskDic =dict(json.loads(t.to_JSON()))
|
||||||
#add a key 'forSortDate' for sorting dates
|
#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():
|
if taskTime >= datetime.date.today():
|
||||||
taskDic['forSortDate'] = taskTime
|
taskDic['forSortDate'] = taskTime
|
||||||
arr.append(taskDic)
|
arr.append(taskDic)
|
||||||
|
|
|
@ -79,6 +79,33 @@ angular.module('SeHub')
|
||||||
$scope.msg.msgToAdd = null;
|
$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()
|
$scope.displayTasks = function()
|
||||||
{
|
{
|
||||||
apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
|
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);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId
|
$scope.getProjects = function(courseId)
|
||||||
// {
|
{
|
||||||
// console.log("YE");
|
apiService.getProjectsByCourse(token, courseId).success(function(data)
|
||||||
// }).error(function(err)
|
{
|
||||||
// {
|
return data;
|
||||||
// console.log("Error: " + err.message);
|
}).error(function(err)
|
||||||
// });
|
{
|
||||||
|
console.log(err.message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.getCampuses = function()
|
$scope.getCampuses = function()
|
||||||
|
@ -106,7 +135,7 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
$scope.campuses = data;
|
$scope.campuses = data;
|
||||||
$scope.getCourses(); // Get all the courses info
|
$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
|
//$scope.displayMessages(); // // Display all messages in message feed and the latest one
|
||||||
}
|
}
|
||||||
|
@ -158,25 +187,6 @@ angular.module('SeHub')
|
||||||
console.log($scope.courseObj);
|
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()
|
$scope.chooseProjectClicked = function()
|
||||||
{
|
{
|
||||||
console.log("choose project Clicked!!");
|
console.log("choose project Clicked!!");
|
||||||
|
@ -185,8 +195,13 @@ angular.module('SeHub')
|
||||||
$scope.getCampuses(); // Get all the campuses info
|
$scope.getCampuses(); // Get all the campuses info
|
||||||
|
|
||||||
// animation
|
// 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.displayTasks(); // Display all tasks in task feed and the latest one
|
||||||
|
// $scope.getProjects(); // Get all projects info
|
||||||
$scope.isEnterd = top.setIsEnterd;
|
$scope.isEnterd = top.setIsEnterd;
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -1,14 +1,32 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
.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()
|
$scope.createTaskClicked = function()
|
||||||
{
|
{
|
||||||
$location.path("/tasks/new"); // Reference to 'newTask' page
|
$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-
|
Closest Task-
|
||||||
<md-card layout-margin layout-padding>
|
<md-card layout-margin layout-padding>
|
||||||
<div>
|
<div>
|
||||||
In Course: {{userTasks[0].courseName}}
|
<md-button ng-click="gotoTask(task)">
|
||||||
|
{{userTasks[0].title}}
|
||||||
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
</md-card>
|
</md-card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -93,7 +95,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{msg.group.courseName}}
|
{{msg.group.courseName}}
|
||||||
<br></br>
|
|
||||||
{{msg.group.projectName}}
|
{{msg.group.projectName}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -130,14 +131,16 @@
|
||||||
|
|
||||||
<md-tab label="Tasks">
|
<md-tab label="Tasks">
|
||||||
<md-content class="md-padding">
|
<md-content class="md-padding">
|
||||||
<h1 class="md-display-2">Tasks</h1>
|
<md-card ng-repeat = "task in userTasks" layout-padding>
|
||||||
<md-card ng-repeat = "task in userTasks">
|
|
||||||
<div>
|
<div>
|
||||||
{{task.courseName}}
|
Title:
|
||||||
|
<md-button ng-click="gotoTask(task)">
|
||||||
|
{{task.title}}
|
||||||
|
</md-button>
|
||||||
|
<br></br>
|
||||||
|
Description: {{task.description}}
|
||||||
</div>
|
</div>
|
||||||
</md-card>
|
</md-card>
|
||||||
|
|
||||||
|
|
||||||
</md-content>
|
</md-content>
|
||||||
</md-tab>
|
</md-tab>
|
||||||
<md-tab label="two">
|
<md-tab label="two">
|
||||||
|
|
|
@ -24,8 +24,13 @@
|
||||||
</md-tab>
|
</md-tab>
|
||||||
<md-tab label="Not Submitted">
|
<md-tab label="Not Submitted">
|
||||||
<md-content class="md-padding">
|
<md-content class="md-padding">
|
||||||
<h1 class="md-display-2">Not Submitted</h1>
|
<md-card ng-repeat = "task in lecturerTasks">
|
||||||
<p> Not Submitted ..</p>
|
<md-button ng-click="gotoTask(task.id)">
|
||||||
|
{{task.title}}
|
||||||
|
</md-button>
|
||||||
|
|
||||||
|
</md-card>
|
||||||
|
|
||||||
</md-content>
|
</md-content>
|
||||||
</md-tab>
|
</md-tab>
|
||||||
<div ng-if = "user.isLecturer">
|
<div ng-if = "user.isLecturer">
|
||||||
|
|
Loading…
Reference in a new issue