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: Helper should not update globals
Date Tue, 03 Jul 2018 10:36:56 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 ef67ddb  Helper should not update globals
ef67ddb is described below

commit ef67ddb73e4111d373b1785ec26b8931beba81b7
Author: Sebb <sebb@apache.org>
AuthorDate: Tue Jul 3 11:36:54 2018 +0100

    Helper should not update globals
---
 www/project/icla/main.rb | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index 62e9595..34eada3 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -36,18 +36,18 @@ helpers do
     pmcData.merge(ppmcData)
   end
   def loadProgress(token)
-    if @token
-      # read the file corresponging to the token
+    if token
+      # read the file corresponding to the token
       # the file name is '/srv/<token>.json
-      @filename = '/srv/icla/' + token + '.json'
+      filename = '/srv/icla/' + token + '.json'
       begin
-        @progress = JSON.parse(File.read(@filename))
+        JSON.parse(File.read(filename))
       rescue SystemCallError => e
-        @progress = {
+        {
           phase: 'error', errorMessage: e.message, errorCode: e.errno
         }
       rescue JSON::ParserError => e
-        @progress = {
+        {
           phase: 'error', errorMessage: e.message, errorCode: 999
         }
       end
@@ -77,7 +77,7 @@ get '/' do
   @token = params['token']
   @mock = params['mock']
   @extra = @mock ? "&mock=" + @mock : ''
-  loadProgress(@token) if @token
+  @progress = loadProgress(@token) if @token
   @phase = @progress['phase'] if @progress
   if @phase == 'discuss'
     redirect to("/discuss?token=" + @token + @extra)
@@ -113,7 +113,7 @@ get '/discuss' do
   @user = env.user
   @member = getMember(@user)
   @token = params['token']
-  loadProgress(@token) if @token
+  @progress = loadProgress(@token) if @token
 
   # not needed for this form but required for other forms
   @allData = {}
@@ -132,7 +132,7 @@ get '/vote' do
   @user = env.user
   @member = getMember(@user)
   @token = params['token']
-  loadProgress(@token) if @token
+  @progress = loadProgress(@token) if @token
 
   # not needed for this form but required for other forms
   @allData = {}


Mime
View raw message