-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask.js
64 lines (55 loc) · 1.57 KB
/
task.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Task
*
* Models independent work items that are a part of the project
*
*/
var Task = function(title, shortDescription, longDescription, priority) {
this.title = title;
this.shortDescription = shortDescription;
this.longDescription = longDescription;
this.priority = priority;
this.owner = [];
// Each work Task will have a unique ID between 0-100 (placeholder) which will be checked against the database first
this.workID = Math.floor(Math.random()*101);
this.startDate = new Date();
}
Task.prototype.getPriority = function() {
var result = "";
result += this.title;
return result;
}
Task.prototype.setPriority = function(newPriority) {
this.priority = newPriority;
}
Task.prototype.getShortDescription = function() {
var result = "";
result += this.shortDescription;
return result;
}
Task.prototype.getLongDescription = function() {
var result = "";
result += this.LongDescription;
return result;
}
Task.prototype.getOwner = function(){
return this.owner;
}
Task.prototype.setOwner = fuction(/*object*/ newOwner){
//If we choose to use an array of owners, we need to iterate through the array until we find an empty slot
for(int i = 0; i < this.owner.length; i++){
if(this.owner[i] == null) {
this.owner[i] = newOwner;
break;
}
}
}
Task.prototype.taskCompleted = function(){
this.endDate = new Date();
}
Task.prototype.showComments = function(comment[]){
var result = "";
for(int i = 0; i < comment.length; i++){
if(comment[i].taskID == this.workID) result += comment[i];
}
return result;
}