You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/07/05 18:40:47 UTC

[whimsy] branch master updated: Use full timestamps

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 ef0d37c  Use full timestamps
ef0d37c is described below

commit ef0d37c23646cc4729c7b0f6cc6ceb61839c336d
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jul 5 19:40:46 2018 +0100

    Use full timestamps
    
    startVoting needs to add both comment and vote entries
---
 www/project/icla/views/actions/update.json.rb | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/www/project/icla/views/actions/update.json.rb b/www/project/icla/views/actions/update.json.rb
index 3267b58..234c40b 100644
--- a/www/project/icla/views/actions/update.json.rb
+++ b/www/project/icla/views/actions/update.json.rb
@@ -33,7 +33,7 @@ def update(data)
     raise ArgumentError.new("Invalid newPhase: '#{newPhase}'")
   end
 
-  timestamp = Time.now.to_s[0..9]
+  timestamp = Time.now.utc.to_s
   addComment = nil
   voteinfo = nil
   if action == 'submitVote'
@@ -61,9 +61,9 @@ def update(data)
     if comment
       addComment = 
       {
-        comment: comment,
-        member: member,
-        timestamp: timestamp,
+        'comment' => comment,
+        'member' => member,
+        'timestamp' => timestamp,
       } 
     else
       raise ArgumentError.new("comment must not be nil for '#{action}'")
@@ -85,6 +85,16 @@ def update(data)
       contents['phase'] = newPhase
       rewrite = true
     end
+    if action == 'startVoting' # need to add a vote to start this off
+      comment0 = contents['comments'][0]['comment'] # initial comment
+      voteinfo = {
+        'vote' => '+1',
+        'comment' => "#{comment0}\nHere is my +1", # append to original comment
+        'member' => member,
+        'timestamp' => timestamp,
+      }
+      addComment['comment'] += "\n**Starting the vote.**"
+    end
     if voteinfo
       contents['votes'] << voteinfo
       rewrite = true