[Git][noosfero/noosfero][master] 2 commits: Bypasses empty keys in graph creation on custom_forms

Rodrigo Souto gitlab at mg.gitlab.com
Mon Jul 23 13:13:15 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
e5a1505f by MatheusRich at 2018-07-20T02:02:39Z
Bypasses empty keys in graph creation on custom_forms

- - - - -
488820dc by Rodrigo Souto at 2018-07-23T16:13:10Z
Merge branch 'prevents-empty-keys' into 'master'

Bypasses empty keys in graph creation on custom_forms

See merge request noosfero/noosfero!1572
- - - - -


1 changed file:

- plugins/custom_forms/lib/custom_forms_plugin/graph.rb


Changes:

=====================================
plugins/custom_forms/lib/custom_forms_plugin/graph.rb
=====================================
@@ -107,8 +107,10 @@ class CustomFormsPlugin::Graph
     list_of_answers = answer.value.split(",")
     list_of_answers.each do |answer_value|
       alternative_and_sum_of_answers = @answers_with_alternative_label[field_id][answer_value]
-      alternative = alternative_and_sum_of_answers.keys.first
-      @answers_with_alternative_label[field_id][answer_value][alternative] += 1
+      if alternative_and_sum_of_answers
+        alternative = alternative_and_sum_of_answers.keys.first
+        @answers_with_alternative_label[field_id][answer_value][alternative] += 1
+      end
     end
   end
 
@@ -116,8 +118,10 @@ class CustomFormsPlugin::Graph
     field_id = answer.field_id
     answer_value = answer.value
     alternative_and_sum_of_answers = @answers_with_alternative_label[field_id][answer_value]
-    alternative = alternative_and_sum_of_answers.keys.first
-    @answers_with_alternative_label[field_id][answer_value][alternative] += 1
+    if alternative_and_sum_of_answers
+      alternative = alternative_and_sum_of_answers.keys.first
+      @answers_with_alternative_label[field_id][answer_value][alternative] += 1
+    end
   end
 
   alias select_answers radio_answers



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/fae3fd88a1942112391b57acd5aff1a6895fc361...488820dce3643509ea59b8ea449e7c284a0ef0fd

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/fae3fd88a1942112391b57acd5aff1a6895fc361...488820dce3643509ea59b8ea449e7c284a0ef0fd
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180723/3d2ffb48/attachment-0001.html>


More information about the Noosfero-dev mailing list