From 5119a5d91f17391b980519d609b9b31b62b9abbc Mon Sep 17 00:00:00 2001 From: Suraj Date: Tue, 1 Mar 2016 00:09:48 +0530 Subject: [PATCH] updated method for finding "overdue" --- db/tasks.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/db/tasks.go b/db/tasks.go index 8e9147d..ea87d80 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -118,11 +118,13 @@ func GetTasks(status, category string) (types.Context, error) { } TaskCreated = TaskCreated.Local() - CurrentTime := time.Now().Local() - week := TaskCreated.AddDate(0, 0, 7) - - if (week.String() < CurrentTime.String()) && (task.Priority != "1") { - task.IsOverdue = true // If one week then overdue by default + if task.Priority != "1" { // if priority is not 1 then calculate, else why bother? + CurrentTime := time.Now().Local() + diff := CurrentTime.Sub(TaskCreated).Hours() + log.Println(diff) + if diff > 168 { + task.IsOverdue = true // If one week then overdue by default + } } task.Created = TaskCreated.Format("Jan 01 2006")