Skip to content

Commit

Permalink
Sort completed tasks by modification date
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbata committed Mar 22, 2021
1 parent df1d2a1 commit 45cf789
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 91 deletions.
7 changes: 6 additions & 1 deletion bin/todo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,12 @@ def list(tasks = nil, patterns = nil)
patterns ||= []
patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty?
items = filter_tasks(tasks, patterns).sort_by do |num, task|
[task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
[
task[:priority] && task[:state] != 'done' ? 0 : 1,
ORDER[task[:state] || 'default'],
task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified],
num
]
end
items.each do |num, task|
state = task[:state] || 'default'
Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "todo-jsonl",
"version": "1.0.2",
"version": "1.0.3",
"description": "todo list manager on the command-line inspired by todo.txt using the jsonl format",
"main": "todo.js",
"bin": {
Expand Down
146 changes: 73 additions & 73 deletions node/todo.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion node/todo.js.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ def list(tasks = nil, patterns = nil)
patterns ||= []
patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty?
items = filter_tasks(tasks, patterns).sort_by do |num, task|
[task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
[
task[:priority] && task[:state] != 'done' ? 0 : 1,
ORDER[task[:state] || 'default'],
task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified],
num
]
end
items.each do |num, task|
state = task[:state] || 'default'
Expand Down
2 changes: 1 addition & 1 deletion todo.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'todo-jsonl'
s.version = '1.0.2'
s.version = '1.0.3'
s.date = '2021-03-22'
s.summary = 'todo list manager on the command-line inspired by todo.txt using the jsonl format'
s.authors = ['Gabor Bata']
Expand Down
24 changes: 12 additions & 12 deletions web/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/app.js.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

`
var term = new VanillaTerminal({
'welcome': '<u>todo list manager</u> REPL v1.0.2<br>Type "help" or "copyright" for more information.<br><br>',
'welcome': '<u>todo list manager</u> REPL v1.0.3<br>Type "help" or "copyright" for more information.<br><br>',
'defaultCallback': default_callback,
'prompt': 'todo',
'commands': {
Expand Down
7 changes: 6 additions & 1 deletion web/todo.js.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ def list(tasks = nil, patterns = nil)
patterns ||= []
patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty?
items = filter_tasks(tasks, patterns).sort_by do |num, task|
[task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
[
task[:priority] && task[:state] != 'done' ? 0 : 1,
ORDER[task[:state] || 'default'],
task[:state] != 'done' ? task[:due] || 'n/a' : task[:modified],
num
]
end
items.each do |num, task|
state = task[:state] || 'default'
Expand Down

0 comments on commit 45cf789

Please sign in to comment.