fewald-worklog 0.1.21 → 0.1.23
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/storage.rb +20 -2
- data/worklog/templates/index.html.erb +6 -8
- data/worklog/webserver.rb +4 -2
- data/worklog/worklog.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf63e1e05ae169d16fe416e3918ca61c2e09bad866e94dc3cc9f8806dea70de3
|
4
|
+
data.tar.gz: baec892afa905f6cd9e58652ebd0d0da64b3e6b970968eece6e51cdfaaa36c68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55386516bc204b362537ffcecb606bb8d4501e3b4769be3e78cdc3609f6cb53ca05906f4e3761b4c2c90b75939e5c8bc5da02835e1a99a98a58c29fb4dd9fccd
|
7
|
+
data.tar.gz: 73e8064262653003784babbe8b4c4a4f309be0e6ef5181010a81f2c97b578bc696cc47da700c5e7d2615e4e1f9263b8997dd9012132b265b5c9fa373167707dd
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.23
|
data/worklog/storage.rb
CHANGED
@@ -20,8 +20,8 @@ class Storage
|
|
20
20
|
Dir.exist?(@config.storage_path)
|
21
21
|
end
|
22
22
|
|
23
|
-
# Return all
|
24
|
-
# @return [Array<DailyLog>] List of logs
|
23
|
+
# Return all logs for all available days
|
24
|
+
# @return [Array<DailyLog>] List of all logs
|
25
25
|
def all_days
|
26
26
|
return [] unless folder_exists?
|
27
27
|
|
@@ -35,6 +35,23 @@ class Storage
|
|
35
35
|
logs
|
36
36
|
end
|
37
37
|
|
38
|
+
# Return all tags as a set
|
39
|
+
# @return [Set<String>] Set of all tags
|
40
|
+
def tags
|
41
|
+
logs = all_days
|
42
|
+
tags = Set[]
|
43
|
+
logs.each do |log|
|
44
|
+
log.entries.each do |entry|
|
45
|
+
next unless entry.tags
|
46
|
+
|
47
|
+
entry.tags.each do |tag|
|
48
|
+
tags << tag
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
tags
|
53
|
+
end
|
54
|
+
|
38
55
|
# Return days between start_date and end_date
|
39
56
|
# If end_date is nil, return logs from start_date to today
|
40
57
|
#
|
@@ -42,6 +59,7 @@ class Storage
|
|
42
59
|
# @param [Date] end_date The end date, inclusive
|
43
60
|
# @param [Boolean] epics_only If true, only return logs with epic entries
|
44
61
|
# @param [Array<String>] tags_filter If provided, only return logs with entries that have at least one of the tags
|
62
|
+
# @return [Array<DailyLog>] List of logs
|
45
63
|
def days_between(start_date, end_date = nil, epics_only = nil, tags_filter = nil)
|
46
64
|
return [] unless folder_exists?
|
47
65
|
|
@@ -64,7 +64,6 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
</nav>
|
67
|
-
|
68
67
|
<hr class="border border-primary border-2 opacity-75">
|
69
68
|
<div class="pb-4">
|
70
69
|
Show
|
@@ -101,22 +100,21 @@
|
|
101
100
|
<div class="dropdown d-inline">
|
102
101
|
<a class="btn border-secondary dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
103
102
|
<% if tags %>
|
104
|
-
<%= tags.first %>
|
103
|
+
<%= tags.size > 1 ? 'multiple tags' : "#{tags.first} tags" %>
|
105
104
|
<% else %>
|
106
105
|
all tags
|
107
106
|
<% end %>
|
108
107
|
</a>
|
109
108
|
<ul class="dropdown-menu">
|
110
109
|
<li><a class="dropdown-item" href="<%= update_query({'tags' => nil}) %>">all tags</a></li>
|
111
|
-
|
112
|
-
|
110
|
+
<% @tags.to_a.each do |tag| %>
|
111
|
+
<li><a class="dropdown-item" href="<%= update_query({'tags' => [tag]}) %>"><%= tag %> tags</a></li>
|
112
|
+
<% end %>
|
113
113
|
</ul>
|
114
114
|
</div>
|
115
115
|
.
|
116
116
|
</div>
|
117
117
|
|
118
|
-
|
119
|
-
|
120
118
|
<%- logs.each do |log| -%>
|
121
119
|
<section class="day">
|
122
120
|
<strong><%= log.date.strftime('%a, %B %-d, %Y') %></strong>
|
@@ -140,10 +138,10 @@
|
|
140
138
|
<p class="entries"><%= log.entries.size %> entries</p>
|
141
139
|
</section>
|
142
140
|
<%- end %>
|
143
|
-
<p><%= total_entries%> entries total</p>
|
141
|
+
<p><%= total_entries %> entries total</p>
|
144
142
|
</div>
|
145
143
|
<hr/>
|
146
|
-
<footer class="container pb-4">
|
144
|
+
<footer class="container pb-4 text-muted">
|
147
145
|
Generated at <%= Time.now.strftime('%Y-%m-%d %H:%M %Z') %>
|
148
146
|
</footer>
|
149
147
|
</body>
|
data/worklog/webserver.rb
CHANGED
@@ -26,8 +26,9 @@ end
|
|
26
26
|
|
27
27
|
# Class to render the main page of the WorkLog web application.
|
28
28
|
class WorkLogResponse
|
29
|
-
def initialize(storage)
|
29
|
+
def initialize(storage, tags)
|
30
30
|
@storage = storage
|
31
|
+
@tags = tags
|
31
32
|
end
|
32
33
|
|
33
34
|
def response(request)
|
@@ -67,11 +68,12 @@ end
|
|
67
68
|
class WorkLogApp
|
68
69
|
def initialize(storage)
|
69
70
|
@storage = storage
|
71
|
+
@tags = @storage.tags
|
70
72
|
end
|
71
73
|
|
72
74
|
def call(env)
|
73
75
|
req = Rack::Request.new(env)
|
74
|
-
WorkLogResponse.new(@storage).response(req)
|
76
|
+
WorkLogResponse.new(@storage, @tags).response(req)
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
data/worklog/worklog.rb
CHANGED
@@ -105,6 +105,9 @@ class Worklog
|
|
105
105
|
mentions.merge!(people) { |_key, oldval, newval| oldval + newval }
|
106
106
|
end
|
107
107
|
|
108
|
+
# Sort the mentions by handle
|
109
|
+
mentions = mentions.to_a.sort_by { |handle, _| handle }
|
110
|
+
|
108
111
|
mentions.each do |handle, v|
|
109
112
|
if people_map.key?(handle)
|
110
113
|
print "#{Rainbow(people_map[handle].name).gold} (#{handle})"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fewald-worklog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Friedrich Ewald
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: httparty
|