]> git.donarmstrong.com Git - neurodebian.git/blobdiff - survey/surveycollector.cgi
Also for stats report which repo and which job number use our setup
[neurodebian.git] / survey / surveycollector.cgi
index 23be6ff3f6632c64bb28357a0e5f325865bdcd4f..a06cec23a0d0211ab820f4bec8585b4770049acc 100755 (executable)
@@ -7,21 +7,21 @@ import os
 
 def validate_form(form):
     messages = []
-    if not 'pers_time' in form or form['pers_time'].value == 'none':
-        messages.append("Please indicate how much time you spend in your personal computing environment.")
-    if not 'man_time' in form or form['man_time'].value == 'none':
-        messages.append("Please indicate how much time you spend in a managed computing environment.")
-    if not 'virt_time' in form or form['virt_time'].value == 'none':
-        messages.append("Please indicate how often you use virtual machines.")
     if not 'bg_datamod' in form or not len(form.getlist('bg_datamod')):
         messages.append("Please indicate want kind of data you are working with.")
     if 'bg_datamod' in form and 'other' in form.getlist('bg_datamod') and not form['bg_datamod_other'].value:
         messages.append("You selected 'Other data modality' but did not specific which one.")
+    if not 'pers_time' in form or form['pers_time'].value == 'none':
+        messages.append("Please indicate how much time you spend in your personal computing environment.")
     if 'pers_maint_time' in form and form['pers_maint_time'].value:
         try:
             t = float(form['pers_maint_time'].value)
         except:
             messages.append("The value you entered as maintenance effort per month needs to be a (floating point) number. For example: 1.2 or 5")
+    if not 'man_time' in form or form['man_time'].value == 'none':
+        messages.append("Please indicate how much time you spend in a managed computing environment.")
+    if not 'virt_time' in form or form['virt_time'].value == 'none':
+        messages.append("Please indicate how often you use virtual machines.")
     return messages
 
 
@@ -61,6 +61,8 @@ def extract_results(form, result):
     # IP
     if 'REMOTE_ADDR' in os.environ:
         result['remote_addr'] = os.environ['REMOTE_ADDR']
+    if 'HTTP_USER_AGENT' in os.environ:
+        result['user_agent'] = os.environ['HTTP_USER_AGENT']
 
     return result
 
@@ -83,7 +85,7 @@ def main():
             result['success'] = True
             result = extract_results(form, result)
             try:
-                logfile = open('/home/neurodebian/surveydata/%s.json' % result['timestamp'], 'w+')
+                logfile = open('/home/neurodebian/survey/data/%s.json' % result['timestamp'], 'w+')
                 logfile.write(json.write(result))
                 logfile.write('\n')
                 logfile.close()
@@ -92,7 +94,7 @@ def main():
                 result['message'] = 'We are very sorry, but the server is unable to store your submission. Please contact team@neuro.debian.net.'
             # send HTML snippet to let the submitter see the results
             try:
-                result['results'] = open('/home/www/neuro.debian.net/www/survey/results_snippet.html').read()
+                result['results'] = open('/home/neurodebian/survey/results_snippet.html').read()
             except:
                 result['results'] = 'We are very sorry, but the statistics could not be displayed. Please contact team@neuro.debian.net to get access.'
         else: