[Git][noosfero/noosfero][master-1.x] Merge branch 'prevents-empty-keys' into 'master'

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


Rodrigo Souto pushed to branch master-1.x at Noosfero / noosfero


Commits:
14e8fbaf by Rodrigo Souto at 2018-07-23T16:13:27Z
Merge branch 'prevents-empty-keys' into 'master'

Bypasses empty keys in graph creation on custom_forms

See merge request noosfero/noosfero!1572

(cherry picked from commit 488820dce3643509ea59b8ea449e7c284a0ef0fd)

e5a1505f Bypasses empty keys in graph creation on custom_forms
- - - - -


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/commit/14e8fbafd99565c7f314c227348f026c32fc6b21

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/14e8fbafd99565c7f314c227348f026c32fc6b21
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/fac1ce53/attachment-0001.html>


More information about the Noosfero-dev mailing list