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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d7b526988aa437d677d22f9e55c93584b84f55089b7bbeb92164761d99e40ea
4
- data.tar.gz: c47b08cba0340519c0b87075347d85a94d592d9d8fcb65c849e3ad94196b08a2
3
+ metadata.gz: bf63e1e05ae169d16fe416e3918ca61c2e09bad866e94dc3cc9f8806dea70de3
4
+ data.tar.gz: baec892afa905f6cd9e58652ebd0d0da64b3e6b970968eece6e51cdfaaa36c68
5
5
  SHA512:
6
- metadata.gz: 208a814fa3b9c3b134c51de73ca9cdecb7b758a652b993cd1dd5fc3c83a7ed2e01ef33b5c371285e5632610c4fbc94cf4a2a9cc74c686b0f6722b5594fc2a39e
7
- data.tar.gz: 9c5fd33b185a96da7800428c1b018e5e9919c25d93d28c03125d41a3090918294ee1c4f3a360e799d4dabf962c91b58a9179580fe6b6ef15d1de07d8f8251d13
6
+ metadata.gz: 55386516bc204b362537ffcecb606bb8d4501e3b4769be3e78cdc3609f6cb53ca05906f4e3761b4c2c90b75939e5c8bc5da02835e1a99a98a58c29fb4dd9fccd
7
+ data.tar.gz: 73e8064262653003784babbe8b4c4a4f309be0e6ef5181010a81f2c97b578bc696cc47da700c5e7d2615e4e1f9263b8997dd9012132b265b5c9fa373167707dd
data/.version CHANGED
@@ -1 +1 @@
1
- 0.1.21
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 days with logs
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 %> tag
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
- <li><a class="dropdown-item" href="<%= update_query({'tags' => ['oncall']}) %>">oncall tags</a></li>
112
- <li><a class="dropdown-item" href="<%= update_query({'tags' => ['1:1']}) %>">1:1 tags</a></li>
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.21
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-04-30 00:00:00.000000000 Z
10
+ date: 2025-05-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: httparty