fewald-worklog 0.1.16 → 0.1.17
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/worklog/person.rb +6 -0
- data/worklog/storage.rb +7 -0
- data/worklog/worklog.rb +12 -1
- 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: 9857acbb9a39b369d83a413b60241f9516d5ed61555aea59cdf25ac3f80bb09a
|
4
|
+
data.tar.gz: 6454a61c7574af2afeb99138262a57678024418a8c94efc17b0afca83ecd4418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df8c31ffcba1778d6967e682ad63494a744c4eae1f3a237e8c339f37b31fd617865aa4b2075f0c6e04c747b3a9275ba816faf88d3c65b79c82f0028e99759698
|
7
|
+
data.tar.gz: da97903ad10a49a112b5753c052dbcb66f56c26cdf35a3cd6dd4c3a8a55f3007e5a2fb438cb59f08a1249cffd12bc85072e8fd2d4f4cecb42087d362439347d1
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.17
|
data/worklog/person.rb
CHANGED
@@ -15,4 +15,10 @@ class Person
|
|
15
15
|
def to_s
|
16
16
|
"#{name} (~#{handle}) <#{email}>"
|
17
17
|
end
|
18
|
+
|
19
|
+
def ==(other)
|
20
|
+
return false unless other.is_a?(Person)
|
21
|
+
|
22
|
+
handle == other.handle && name == other.name && email == other.email && team == other.team && notes == other.notes
|
23
|
+
end
|
18
24
|
end
|
data/worklog/storage.rb
CHANGED
@@ -112,6 +112,13 @@ class Storage
|
|
112
112
|
daily_log.entries
|
113
113
|
end
|
114
114
|
|
115
|
+
def load_people
|
116
|
+
load_people!
|
117
|
+
rescue Errno::ENOENT
|
118
|
+
WorkLogger.info 'Unable to load people.'
|
119
|
+
[]
|
120
|
+
end
|
121
|
+
|
115
122
|
# Load all people from the people file
|
116
123
|
# @return [Array<Person>] List of people
|
117
124
|
def load_people!
|
data/worklog/worklog.rb
CHANGED
@@ -90,10 +90,21 @@ class Worklog
|
|
90
90
|
|
91
91
|
mentions = {}
|
92
92
|
all_logs = @storage.all_days
|
93
|
+
all_people = @storage.load_people
|
94
|
+
people_map = all_people.to_h { |person| [person.handle, person] }
|
95
|
+
|
93
96
|
all_logs.map(&:people).each do |people|
|
94
97
|
mentions.merge!(people) { |_key, oldval, newval| oldval + newval }
|
95
98
|
end
|
96
|
-
|
99
|
+
|
100
|
+
mentions.each do |handle, v|
|
101
|
+
if people_map.key?(handle)
|
102
|
+
print "#{Rainbow(people_map[handle].name).gold} (#{handle})"
|
103
|
+
else
|
104
|
+
print handle
|
105
|
+
end
|
106
|
+
puts ": #{v} #{pluralize(v, 'occurrence')}"
|
107
|
+
end
|
97
108
|
end
|
98
109
|
|
99
110
|
def tags(_options = {})
|