diff options
| author | Stuart Skelton <stuarts@broadbean.com> | 2017-08-04 22:03:43 +0100 |
|---|---|---|
| committer | Stuart Skelton <stuarts@broadbean.com> | 2017-08-04 22:03:43 +0100 |
| commit | d59a0986f51e8a09c6c15446f7141acf86d27d41 (patch) | |
| tree | 4a290e9787bb8379a37183b63f4a53a8cdb8c563 /todolist | |
| parent | 05ad454f50422f0eab4228e819cbadbe9e6a918a (diff) | |
Group similar code together.
Diffstat (limited to 'todolist')
| -rw-r--r-- | todolist/todo_list.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/todolist/todo_list.go b/todolist/todo_list.go index a1e9f1c..4623a22 100644 --- a/todolist/todo_list.go +++ b/todolist/todo_list.go @@ -54,14 +54,6 @@ func (t *TodoList) Unarchive(id int) { t.Data = append(t.Data, todo) } -func (t *TodoList) IndexOf(todoToFind *Todo) int { - for i, todo := range t.Data { - if todo.Id == todoToFind.Id { - return i - } - } - return -1 -} func (t *TodoList) Prioritize(id int) { todo := t.FindById(id) todo.Prioritize() @@ -76,6 +68,15 @@ func (t *TodoList) Unprioritize(id int) { t.Data = append(t.Data, todo) } +func (t *TodoList) IndexOf(todoToFind *Todo) int { + for i, todo := range t.Data { + if todo.Id == todoToFind.Id { + return i + } + } + return -1 +} + type ByDate []*Todo func (a ByDate) Len() int { return len(a) } |
