You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/04/22 20:11:21 UTC
[whimsy] branch master updated: Rubys helps to rubify the counting
This is an automated email from the ASF dual-hosted git repository.
curcuru 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 cbad579 Rubys helps to rubify the counting
cbad579 is described below
commit cbad57938670ade59739750b4016068d844e91c4
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Sat Apr 22 16:11:17 2017 -0400
Rubys helps to rubify the counting
---
www/test/conferences.cgi | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/www/test/conferences.cgi b/www/test/conferences.cgi
index aa94f19..384e3f3 100755
--- a/www/test/conferences.cgi
+++ b/www/test/conferences.cgi
@@ -30,7 +30,6 @@ _html do
end
end
end
- ct, ticket, hotel, travel = 0, 0, 0, 0
_div.row do
_table.table.table_hover do
_thead_ do
@@ -45,21 +44,11 @@ _html do
end
_tbody do
conflist.each do | conf |
- ct += 1
_tr_ do
_td do
_a conf['name'], href: conf['website']
end
if conf['speaker_kit'] then
- if conf['speaker_kit']['ticket_included'] then
- ticket += 1
- end
- if conf['speaker_kit']['hotel_included'] then
- hotel += 1
- end
- if conf['speaker_kit']['travel_included'] then
- travel += 1
- end
_td conf['speaker_kit']['ticket_included']
_td conf['speaker_kit']['hotel_included']
_td conf['speaker_kit']['travel_included']
@@ -82,9 +71,20 @@ _html do
end
end
end
+ counts = %w(ticket_included hotel_included travel_included).map do |field|
+ matches = conflist.select do |conf|
+ conf['speaker_kit'] && conf['speaker_kit'][field]
+ end
+
+ [field, matches.count]
+ end
+ counts = counts.to_h
_p.count do
- _b "Out of total: #{ct} conferences"
- _ ", ones that cover ticket: #{ticket}, hotel: #{hotel}, travel: #{travel}."
+ _b "Out of total: #{conflist.count} conferences"
+ _ ", number that cover:"
+ counts.each do |s, v|
+ _ "#{s}: #{v}"
+ end
end
_script %{
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].