updated method for finding "overdue"
This commit is contained in:
parent
7a0b369dcb
commit
5119a5d91f
12
db/tasks.go
12
db/tasks.go
|
@ -118,11 +118,13 @@ func GetTasks(status, category string) (types.Context, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskCreated = TaskCreated.Local()
|
TaskCreated = TaskCreated.Local()
|
||||||
CurrentTime := time.Now().Local()
|
if task.Priority != "1" { // if priority is not 1 then calculate, else why bother?
|
||||||
week := TaskCreated.AddDate(0, 0, 7)
|
CurrentTime := time.Now().Local()
|
||||||
|
diff := CurrentTime.Sub(TaskCreated).Hours()
|
||||||
if (week.String() < CurrentTime.String()) && (task.Priority != "1") {
|
log.Println(diff)
|
||||||
task.IsOverdue = true // If one week then overdue by default
|
if diff > 168 {
|
||||||
|
task.IsOverdue = true // If one week then overdue by default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
task.Created = TaskCreated.Format("Jan 01 2006")
|
task.Created = TaskCreated.Format("Jan 01 2006")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue