work_md 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7f163bb109aa82d9095042209b18157e3ba0ff0ab23456b43e0cd65ba90aeee
4
- data.tar.gz: a78b3daa4090a73e1bcdda5e51eb30718a4787f2932027c5945e6e14322b826b
3
+ metadata.gz: a981624ebcb01d89fcb6097d5969c8a4953c548c5f0af0ccad81c2ae56af7945
4
+ data.tar.gz: 2e22f7de5b3fc2e72025337b7176cb637e09d67ff56e2bbfd2f025ea21108eea
5
5
  SHA512:
6
- metadata.gz: d2e117fa8755001b8f4ccb44a77666e2c3b8f25c1deb959d8c702c55096bfb4cf625923eb09cf184ff3aef14659beabfdd3718ecd492384044efb5b01010ca29
7
- data.tar.gz: 7a555df5793cbc958eff5ff7f42a5078357afeb9ab66b561ff4a82a04c0e120c565f22041e8bf1bff3b8e5f5ca345945b570cd015b66b92f037b481a4fd602b6
6
+ metadata.gz: 72060087a643c751da31160dc7d24b8747655ae1f42561fd1d64b4de9172304472d22fcda8da3d10dbf11a1cab27cbed48a5406a63881113cee9cc3a64e69620
7
+ data.tar.gz: cb634d22d720628d72a13e6b7975a27934f43064ef9bcacd82eb63d67999703b8df8d00ac5adb923c6d6fa9ab21d34c811b700a6f41ec6a03c5730a4f29ec3c1
@@ -65,7 +65,14 @@ module WorkMd
65
65
  end
66
66
  f.puts("---\n\n")
67
67
  f.puts("### #{t[:pomodoros]} (#{parser.average_pomodoros} #{t[:per_day]}):\n\n")
68
- f.puts(parser.pomodoros)
68
+ f.puts(parser.pomodoros_sum)
69
+ f.puts("\n\n")
70
+
71
+ parser.pomodoros_bars.each do |pomodoro_bar|
72
+ f.puts(pomodoro_bar)
73
+ f.puts("\n\n")
74
+ end
75
+ f.puts("\n\n")
69
76
  end
70
77
 
71
78
  editor = WorkMd::Config.editor
@@ -75,20 +75,29 @@ module WorkMd
75
75
  end
76
76
 
77
77
  def average_pomodoros
78
- if @parsed_files.size.positive? && pomodoros.positive?
79
- return (pomodoros.to_f / @parsed_files.size).round(1)
78
+ if @parsed_files.size.positive? && pomodoros_sum.positive?
79
+ return (pomodoros_sum.to_f / @parsed_files.size).round(1)
80
80
  end
81
81
 
82
82
  0
83
83
  end
84
84
 
85
- def pomodoros
85
+ def pomodoros_sum
86
86
  raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
87
87
 
88
- @pomodoros ||=
88
+ @pomodoros_sum ||=
89
89
  @parsed_files.reduce(0) { |sum, f| sum + f.pomodoros || 0 }
90
90
  end
91
91
 
92
+ def pomodoros_bars
93
+ raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
94
+
95
+ @pomodoros_bars ||=
96
+ @parsed_files.map do |f|
97
+ "(#{f.date}) #{(1..f.pomodoros).map { '◘' }.join }"
98
+ end
99
+ end
100
+
92
101
  def freeze
93
102
  @frozen = true
94
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkMd
4
- VERSION = '0.2.8'
4
+ VERSION = '0.2.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Fernandez Teixeira