From 5bf740d45497977e6f2b16560a86ae793a9516a1 Mon Sep 17 00:00:00 2001
From: Bohung
Date: Thu, 27 Jan 2022 17:04:13 +0800
Subject: [PATCH] Fix bug.
---
app/models/cancerpredictfields.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb
index e319530..e1e5a93 100644
--- a/app/models/cancerpredictfields.rb
+++ b/app/models/cancerpredictfields.rb
@@ -185,12 +185,12 @@ class Cancerpredictfields
@years = self.years
@head_name = ['Treatment','Additional_Benefit','Overall_Survival']
# @head_name = ['Treatment','Overall_Survival']
- @table_head = @head_name.map{|name| I18n.t('cancerpredict.table.'+name)}
@therapy_names = self.treatment_method
I18n.available_locales.each do |locale|
I18n.with_locale(locale) do
+ @table_head = @head_name.map{|name| I18n.t('cancerpredict.table.'+name)}
@therapy_choices = [I18n.t('cancerpredict.table.Surgeryonly')]
- self.form_show_in_result.values.each{|choice| @therapy_choices.push choice["name"][locale]}
+ self.form_show_in_result.values.each{|choice| @therapy_choices.push choice["name"][locale].to_s}
tmp_table = "#{I18n.t("cancerpredict.table.table")}"
tmp_table += ''+self.table_above_texts[locale].to_s+'
'
tmp_table += (''+(locale.to_s == 'zh_tw' ? '第' : '')+'')
@@ -211,7 +211,7 @@ class Cancerpredictfields
@texts = @texts.split('{{years}}')
@texts.delete('')
tmp_text = "#{I18n.t("cancerpredict.table.text")}"
- tmp_text += (''+@texts[0])
+ tmp_text += (''+@texts[0].to_s)
@years.each{|year| tmp_text += ('')}
if @texts.count > 1
tmp_text += (@texts[1]+'') if @texts.count > 1
@@ -228,7 +228,7 @@ class Cancerpredictfields
@surgery_only_texts = ''
end
tmp_text += @surgery_only_texts
- tmp_text += ''+self.extra_texts[locale]+'
'
+ tmp_text += ''+(self.extra_texts[locale].to_s rescue '')+''
tmp_text_translations[locale] = tmp_text
end
end