This commit is contained in:
BoHung Chiu 2022-02-07 18:30:42 +08:00
parent f157dffc28
commit 4115a98ecb
1 changed files with 1 additions and 1 deletions

View File

@ -331,7 +331,7 @@ class Cancerpredictfields
js_code += "\n #{self.tmp_hidden_variables_for_js}" js_code += "\n #{self.tmp_hidden_variables_for_js}"
formula = text_to_math(self.prediction_formula) formula = text_to_math(self.prediction_formula)
self.all_variables.each do |k| self.all_variables.each do |k|
formula = formula.gsub(/#{k}?(-|\+|\*|\s|\=)/){ "result[\"#{k.strip}\"]#{$1}" } formula = formula.gsub(/(\A|[^\w])#{k}($|[^\w])/){|f| "#{$1}result[\"#{k.strip}\"]#{$2}" }
end end
formula_variables = self.tmp_lpv_variables.map{|v| v} formula_variables = self.tmp_lpv_variables.map{|v| v}
js_code = "\n function calculate_first_lpv(result_json){ js_code = "\n function calculate_first_lpv(result_json){