fewald-worklog 0.2.24 → 0.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/project.rb +23 -0
- data/lib/worklog.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7412052ae6f6e4ff3fab0cc85cc061a3370aa144a5ae0d720e8b4c18771f71b5
|
|
4
|
+
data.tar.gz: 347ca8cf68c1170c1ccbf2a0d939bc2507257a33c9ae3bdd4cdf8cd46acb1d74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e31310232c8c15e9215adefefcd160cf42dac279c3a5e72cea7b7b1193abf9ed1ce15540237ba90c3f16c719b7c170dd27dd628b1082eef857354b1611e5f9a
|
|
7
|
+
data.tar.gz: b581a94567bbc30cce66f634d9d8c6879c8f0cc82b27867972a0c9c81927516ee2065803347d9e071ddd2e112bf3a2d633c712aec2df188cbeb1c717738fbb37
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.25
|
data/lib/project.rb
CHANGED
|
@@ -67,5 +67,28 @@ module Worklog
|
|
|
67
67
|
def ended?
|
|
68
68
|
!end_date.nil? && end_date < Date.today
|
|
69
69
|
end
|
|
70
|
+
|
|
71
|
+
# Generate an ASCII activity graph for the project.
|
|
72
|
+
# The graph shows activity over time, with each character representing a day.
|
|
73
|
+
# More active days are represented with a different character.
|
|
74
|
+
# @return [String] An ASCII representation of the activity graph.
|
|
75
|
+
def activity_graph
|
|
76
|
+
graph = String.new
|
|
77
|
+
# Generate the graph for the last 30 days
|
|
78
|
+
(0..29).each do |i|
|
|
79
|
+
date = Date.today - i
|
|
80
|
+
graph << if entries.any? { |entry| entry.time.to_date == date }
|
|
81
|
+
'#'
|
|
82
|
+
else
|
|
83
|
+
'.'
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
graph.reverse!
|
|
88
|
+
|
|
89
|
+
graph << "\n"
|
|
90
|
+
graph << ("#{' ' * 31}^\n")
|
|
91
|
+
graph << ("#{' ' * 31}Today")
|
|
92
|
+
end
|
|
70
93
|
end
|
|
71
94
|
end
|
data/lib/worklog.rb
CHANGED
|
@@ -233,6 +233,7 @@ module Worklog
|
|
|
233
233
|
puts " End date: #{project.end_date.strftime('%b %d, %Y')}" if project.end_date
|
|
234
234
|
puts " Status: #{project.status}" if project.status
|
|
235
235
|
puts " Last activity: #{project.last_activity.strftime('%b %d, %Y')}" if project.last_activity
|
|
236
|
+
puts " #{project.activity_graph}"
|
|
236
237
|
|
|
237
238
|
next unless project.entries && !project.entries.empty?
|
|
238
239
|
|