You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/03/28 16:00:06 UTC
[whimsy] branch master updated: show number of responses
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 8af2200 show number of responses
8af2200 is described below
commit 8af22000734d48735dae05e0a6385f95f6070ba7
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Mar 28 11:59:52 2018 -0400
show number of responses
---
www/board/agenda/views/actions/responses.json.rb | 12 ++++++-----
.../agenda/views/elements/additional-info.js.rb | 24 +++++++++++++---------
www/board/agenda/views/models/responses.js.rb | 2 +-
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/www/board/agenda/views/actions/responses.json.rb b/www/board/agenda/views/actions/responses.json.rb
index 0afb43c..72b46a1 100644
--- a/www/board/agenda/views/actions/responses.json.rb
+++ b/www/board/agenda/views/actions/responses.json.rb
@@ -1,3 +1,7 @@
+#
+# Scan board@ for feedback threads. Return number of responses in each.
+#
+
require 'date'
maildir = '/srv/mail/board/'
@@ -13,12 +17,10 @@ Dir[maildir + '*'].sort.each do |dir|
next unless subject and subject =~ /Board feedback on .* report/
date, pmc = subject.scan(/Board feedback on ([-\d]+) (.*) report/).first
next unless date
- responses[date] ||= []
- unless responses[date].include? pmc
- responses[date].push pmc
- end
+ responses[date] ||= Hash.new {|hash, key| hash[key] = 0}
+ responses[date][pmc] += 1
end
end
-responses.values.each {|value| value.sort!}
+responses.each {|key, value| responses[key] = responses[key].sort.to_h}
responses.sort.to_h
diff --git a/www/board/agenda/views/elements/additional-info.js.rb b/www/board/agenda/views/elements/additional-info.js.rb
index 81662e5..8b6555c 100644
--- a/www/board/agenda/views/elements/additional-info.js.rb
+++ b/www/board/agenda/views/elements/additional-info.js.rb
@@ -98,20 +98,24 @@ class AdditionalInfo < Vue
# compute date range: from date of that meeting to now
dfr = date.gsub('_', '-')
dto = Date.new(Date.now()).toISOString()[0...10]
+ count = Responses.find(dfr, @@item.title)
- if date > '2017_11' # when board was no longer copied on the
- # initial email
+ if count
+ # when board was copied on the initial email
+ count -= 1 if date < '2017_11'
- if Responses.find(dfr, @@item.title)
- link = '(responses)'
- elsif Responses.loading
- link = '(loading)'
- else
- link = '(no responses)'
- end
+ if count == 0
+ link = "(no responses)"
+ elsif count == 1
+ link = '(1 response)'
+ else
+ link = "(#{count} responses)"
+ end
+ elsif Responses.loading
+ link = '(loading)'
else
- link = '(thread)'
+ link = '(no responses)'
end
end
diff --git a/www/board/agenda/views/models/responses.js.rb b/www/board/agenda/views/models/responses.js.rb
index 64c84fc..02bf34a 100644
--- a/www/board/agenda/views/models/responses.js.rb
+++ b/www/board/agenda/views/models/responses.js.rb
@@ -11,7 +11,7 @@ class Responses
def self.find(date, name)
if @@list
- return @@list[date] and @@list[date].include? name
+ return @@list[date] and @@list[date][name]
else
@@list = {}
JSONStorage.fetch 'responses' do |list|
--
To stop receiving notification emails like this one, please contact
rubys@apache.org.