5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/subcommands/series.rb', line 5
def ls
series = ::Series.all.order(options[:order].to_sym => :desc)
series_stats = Statistics.new
table = [['#', 'log', 'start', 'end', 'hours']] series.each do |s|
next if s.log_id.blank?
start = s.start
finish = s.end
series_stats << timer = start.difference(finish || Time.now)
start = time_display(start) if start
finish = time_display(finish) if finish
table << [s.id,
s.log.name,
start,
finish || "active",
(timer/3600).round(2).to_s] end
puts ''
print_table table
puts ''
say [series.count.to_s, "series out of", ::Series.count].join(' '), :cyan
say [(series_stats.mean/3600).round(2), " hours avg"].join(' '), :cyan
end
|