From 05ad454f50422f0eab4228e819cbadbe9e6a918a Mon Sep 17 00:00:00 2001 From: Stuart Skelton Date: Fri, 4 Aug 2017 22:02:37 +0100 Subject: Empower the todo_item to set its attributes correctly itself. --- todolist/todo_item.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'todolist/todo_item.go') diff --git a/todolist/todo_item.go b/todolist/todo_item.go index eecb409..0c30707 100644 --- a/todolist/todo_item.go +++ b/todolist/todo_item.go @@ -45,6 +45,22 @@ func (t *Todo) Uncomplete() { t.CompletedDate = "" } +func (t *Todo) Archive() { + t.Archived = true +} + +func (t *Todo) Unarchive() { + t.Archived = false +} + +func (t *Todo) Prioritize() { + t.IsPriority = true +} + +func (t *Todo) Unprioritize() { + t.IsPriority = false +} + func (t Todo) CompletedDateToDate() string { parsedTime, _ := time.Parse(ISO8601_TIMESTAMP_FORMAT, t.CompletedDate) return parsedTime.Format("2006-01-02") -- cgit v1.3