51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/ruby_todo/concerns/statistics.rb', line 51
def display_notebook_stats(notebook)
total_tasks = notebook.tasks.count
return puts "No tasks found in notebook '#{notebook.name}'" if total_tasks.zero?
todo_count = notebook.tasks.where(status: "todo").count
in_progress_count = notebook.tasks.where(status: "in_progress").count
done_count = notebook.tasks.where(status: "done").count
archived_count = notebook.tasks.where(status: "archived").count
puts "\nStatistics for notebook '#{notebook.name}':"
puts "Total tasks: #{total_tasks}"
puts "Todo: #{todo_count} (#{percentage(todo_count, total_tasks)}%)"
puts "In Progress: #{in_progress_count} (#{percentage(in_progress_count, total_tasks)}%)"
puts "Done: #{done_count} (#{percentage(done_count, total_tasks)}%)"
puts "Archived: #{archived_count} (#{percentage(archived_count, total_tasks)}%)"
display_priority_distribution(notebook.tasks)
display_tag_distribution(notebook.tasks)
display_overdue_tasks(notebook.tasks)
end
|