From 98738db5d189e060384da5f047cf00e6f7802059 Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Mon, 9 Dec 2019 00:43:40 +0800 Subject: [PATCH] finish js --- app/assets/javascripts/cancer_predict.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 6e7224a..581ef9c 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -208,8 +208,8 @@ $(document).ready(function(){ var servive_ratio = (Math.exp(lpv_calc[year])**lpv_current)*100; var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1]; servive_ratio_arr.push(servive_ratio); - $('tr.'+arguments[0]+' td.Overall_Survival').html(servive_ratio); - $('tr.'+arguments[0]+' td.Additional_Benefit').html(benefit); + $('tr.'+arguments[0]+' td.Overall_Survival').html(servive_ratio+'%'); + $('tr.'+arguments[0]+' td.Additional_Benefit').html(benefit+'%'); $('tr.'+arguments[0]).css('display','table-row'); $('tr.tr_show').eq(-1).after($('tr.'+arguments[0])); $('tr.'+arguments[0]).addClass('tr_show'); @@ -244,9 +244,9 @@ $(document).ready(function(){ lpv_real[i] -= lpv_dict[arguments[0]] var servive_ratio = (Math.exp(lpv_calc[year])**lpv_real[i])*100; var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1]; - $('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio); + $('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%'); $('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio); - $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit); + $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit+'%'); $('.'+active_treatment[i]+'.Additional_Benefit').html(benefit); }; var add_choices = []; @@ -310,13 +310,15 @@ $(document).ready(function(){ var servive_ratio = (Math.exp(lpv_calc[year])**lpv_real[i])*100; var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length-1]; servive_ratio_arr.push(servive_ratio); - $('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio); + $('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%'); $('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio); - $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit); - $('.'+active_treatment[i]+'.Additional_Benefit').html(benefit); + if(i != 0){ + $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit+'%'); + $('.'+active_treatment[i]+'.Additional_Benefit').html(benefit); + } } $('.'+active_treatment[0]+'.Overall_Survival').html(servive_ratio_arr[0]); - $('.survive_person').html(servive_ratio); + $('.survive_person').html(servive_ratio+'%'); }); }); })