-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask.js
65 lines (52 loc) · 1.82 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
65
const FormatedDate = require('./Date.js');
const TaskManager = require('./taskmanager.js')
const Date = new FormatedDate();
const TaskController = new TaskManager();
// task status -open, in-progress, peer-review, Resolve conflict, verified
class Task {
constructor(taskName, description,taskOwner){
this.taskName = taskName
this.description = description
this.taskOwner = [taskOwner]
this.createdDate = Date.getCurrentDate()
this.createdTimeInMillis = Date.getCurrentTimeinMillis()
this.updateDate = Date.getCurrentDate()
this.updatedTimeInMillis = Date.getCurrentTimeinMillis()
this.TaskManager = new TaskManager();
this.TaskStatus = this.TaskManager.defaultStatus.OPEN
this.taskFlow = [[this.task.status,this.createdTimeInMillis]]
}
addTaskOwner(taskOwner) {
this.taskOwner.push(taskOwner)
}
getValidTransistion() {
return this.TaskManager.getValidTransistion(this.TaskStatus)
}
makeTransistion(status) {
let validTranstions = this.getValidTransistion()
console.log(validTranstions)
if(validTranstions.includes(status)) {
this.TaskStatus = status.toUpperCase()
this.taskFlow.push([this.TaskStatus,Date.getCurrentTimeinMillis()])
this.updatedTimeInMillis = Date.getCurrentTimeinMillis()
this.updateDate = Date.getCurrentDate
}
}
getTaskFlow() {
return this.taskFlow
}
}
class TaskOwner {
constructor(name,email,tasks) {
this.name = name
this.email = email
if (tasks.length === 0) {
this.tasks = tasks
} else {
this.tasks = []
}
}
}
let task = new Task()
console.log(task.getValidTransistion())
console.log(task.makeTransistion('InProgress'))