whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Provide a running tally
Date Thu, 05 Jul 2018 12:44:39 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb 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 9ff4f78  Provide a running tally
9ff4f78 is described below

commit 9ff4f784d1ecca2eb52685214d2e5f323c4c3934
Author: Sebb <sebb@apache.org>
AuthorDate: Thu Jul 5 13:44:37 2018 +0100

    Provide a running tally
---
 www/project/icla/views/pages/vote.js.rb | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/www/project/icla/views/pages/vote.js.rb b/www/project/icla/views/pages/vote.js.rb
index 37cd2d4..b0a7e46 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -88,8 +88,10 @@ class Vote < Vue
         end
       end
 
+      tally = {} # most recent vote details for each member
       # previous votes
       @votes.each {|v|
+        tally[v.member] = [v.vote, v.timestamp]
         _p v.vote + ' From: ' + v.member + ' Date: ' + v.timestamp
       }
 
@@ -99,6 +101,31 @@ class Vote < Vue
         _p c.comment
       }
 
+      _h5 'Summary of voting so far'
+      
+      vote_count = {}
+      tally.each_key { |k|
+        vote_count[tally[k][0]] ||= 0
+        vote_count[tally[k][0]] += 1
+        _ k + ' ' + tally[k][0] + ' ' + tally[k][1]
+        _br
+      }
+
+      _br
+
+      vote_count.each_key {|k|
+        _ k + ': ' + vote_count[k]
+        _br
+      }
+
+      started = new Date(@votes[0]['timestamp'])
+      now = new Date()
+      elapsed = (now - started) / (1000 * 60 * 60 * 24)
+      _ 'Voting started: ' + started.toISOString().slice(0,10) + ' Days elapsed: ' + elapsed.to_i
+
+      _p
+
+
       #
       # Submission buttons
       #


Mime
View raw message