diff --git a/app/controllers/admin/cancerpredicts_controller.rb b/app/controllers/admin/cancerpredicts_controller.rb
index 46bc929..d3f2a46 100644
--- a/app/controllers/admin/cancerpredicts_controller.rb
+++ b/app/controllers/admin/cancerpredicts_controller.rb
@@ -378,14 +378,14 @@ class Admin::CancerpredictsController < OrbitAdminController
@table_str_left += ''
- if @field_property["comment_text"] != ""
+ if @field_property["comment_text"].present?
@table_str_left += ''
@table_str_left += ''
else
@site_locales = current_site.in_use_locales
@site_locales.delete(current_locale)
@site_locales.each do |locale|
- next if property["comment_text"][locale.to_s] == ""
+ next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s]
break
end
@@ -444,11 +444,11 @@ class Admin::CancerpredictsController < OrbitAdminController
@site_locales = current_site.in_use_locales
@site_locales.delete(current_locale)
@site_locales.each do |locale|
- next if property["comment_text"][locale.to_s] == ""
+ next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s]
break
end
- if @field_property["comment_text"] != ""
+ if @field_property["comment_text"].present?
@table_str_right += ''
@table_str_right += ''
else
@@ -528,18 +528,18 @@ class Admin::CancerpredictsController < OrbitAdminController
@table_result_choice_fileds += ''
- if @field_property["comment_text"] != ""
+ if @field_property["comment_text"].present?
@table_result_choice_fileds += ''
@table_result_choice_fileds += ''
else
@site_locales = current_site.in_use_locales
@site_locales.delete(current_locale)
@site_locales.each do |locale|
- next if property["comment_text"][locale.to_s] == ""
+ next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s]
break
end
- if @field_property["comment_text"] != ""
+ if @field_property["comment_text"].present?
@table_result_choice_fileds += ''
@table_result_choice_fileds += ''
else
diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb
index 008e846..e319530 100644
--- a/app/models/cancerpredictfields.rb
+++ b/app/models/cancerpredictfields.rb
@@ -139,21 +139,20 @@ class Cancerpredictfields
end
self.tmp_hidden_variables_for_js = tmp_hidden_variables.rstrip.gsub(/\n\s+/,"\n ").gsub("\n",";\n") + ";"
self.fix_hidden_variables = []
- self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=]+)=([^=])/).select{|s| s.present?}.each_slice(2).map do |a,b|
+ self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
a = a.strip
self.fix_hidden_variables << a
if b
- puts ("result[\"#{a}\"]=" + b)
- ("result[\"#{a}\"]=" + b)
+ ("result[\"#{a}\"]=" + b.gsub("\n",""))
else
a
end
end.join("\n")
self.fix_hidden_variables = self.fix_hidden_variables.uniq
- formula = formula.split(/^([^=]+)=([^=])/).select{|s| s.present?}.each_slice(2).map do |a,b|
+ formula = formula.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
a = a.strip
if b
- ("result[\"#{a}\"]=" + b)
+ ("result[\"#{a}\"]=" + b.gsub("\n",""))
else
a
end
@@ -282,10 +281,10 @@ class Cancerpredictfields
if (mapping_data_from_csv != {} && !mapping_data_from_csv[@variable].blank?)
js_code += " mapping_hash = mapping_data_from_csv['#{@variable}'];\r\n"
js_code += " temp_index = 0;\r\n"
- js_code += " temp_value = result[#{@variable}];\r\n"
+ js_code += " temp_value = result['#{@variable}'];\r\n"
js_code += " index = 0;
$.each(mapping_hash,function(k,v){
- if( i == 0 ){
+ if( index == 0 ){
var index_val = v.indexOf(temp_value);
if( index_val != -1 ){
temp_index = index_val;