Class: Tasks
Instance Method Summary
collapse
Methods inherited from DB
#create, #info, #initialize
Methods included from Timer
#last_mon, #now
Constructor Details
This class inherits a constructor from DB
Instance Method Details
#last ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/tasks.rb', line 3
def last
@db.fetch("SELECT * FROM tasks AS T ORDER BY (SELECT MAX(ts) FROM
(SELECT notes.created_at AS ts FROM notes WHERE task_id = T.id
UNION SELECT subtasks.created_at AS ts FROM subtasks WHERE task_id = T.id
UNION SELECT subtasks.finished_at AS ts FROM subtasks WHERE task_id = T.id
UNION SELECT tasks.created_at AS ts FROM tasks WHERE id = T.id)) DESC LIMIT 0, 10;").to_a
end
|
#list ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/tasks.rb', line 11
def list
@db.fetch("SELECT * FROM tasks AS T ORDER BY (SELECT MAX(ts) FROM
(SELECT notes.created_at AS ts FROM notes WHERE task_id = T.id
UNION SELECT subtasks.created_at AS ts FROM subtasks WHERE task_id = T.id
UNION SELECT subtasks.finished_at AS ts FROM subtasks WHERE task_id = T.id
UNION SELECT tasks.created_at AS ts FROM tasks WHERE id = T.id)) DESC;").to_a
end
|