From 74fff0681819310e83b893e9e013facf35e5fc12 Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Tue, 17 Dec 2019 21:27:11 +0800 Subject: [PATCH] edit the calculate of the predict and edit css to make the logo in the right place and right size --- app/assets/javascripts/cancer_predict.js | 10 +++++----- app/assets/stylesheets/cancer_predict.css | 10 +++++++++- app/controllers/cancerpredicts_controller.rb | 10 +++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index f188926..91695b2 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -484,10 +484,10 @@ $(document).ready(function(){ }; function calculate_first_lpv(result_json){ result = {} - result['age1'] = -Math.pow((Number(result_json['age'])/100),0.5); - result['age2'] = -Math.pow((Number(result_json['age'])/100),0.5)*Math.log(result_json['age']/100); - result['size1'] = -Math.log(Number(result_json['size'])/10); - result['nposit'] = -Math.pow(((Number(result_json['ratio'])+0.1)/0.1),0.5); + result['age1'] = Math.pow((Number(result_json['age'])/100),0.5); + result['age2'] = Math.pow((Number(result_json['age'])/100),0.5)*Math.log(result_json['age']/100); + result['size1'] = Math.log(Number(result_json['size'])/10); + result['nposit'] = Math.pow(((Number(result_json['ratio'])+0.1)/0.1),0.5); if( Number(result_json['grade']) == 2) result['grade_2'] = 1; else @@ -521,7 +521,7 @@ $(document).ready(function(){ else result['lvi_yes'] = 0; try{ - result['lpv'] = ((result['age1']-0.7276655)*(10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ + result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+ result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04); }catch{result['lpv'] = "error"}; diff --git a/app/assets/stylesheets/cancer_predict.css b/app/assets/stylesheets/cancer_predict.css index 6822d1f..0484b66 100644 --- a/app/assets/stylesheets/cancer_predict.css +++ b/app/assets/stylesheets/cancer_predict.css @@ -3,13 +3,21 @@ } .head_logo{ float:left; - height: 6em; + height: 4em; +} +@media screen and (max-width: 48em) .navbar-brand{ + width: 100%; +} +.navbar-brand>img.head_logo{ + width: 70%; + height: auto; } .header-nav{ top:0 !important; } .title_texts{ color:rgb(210, 106, 2); + display:none; } .cencer_table_name{ display: inline-block; diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index a86059f..7501f93 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -41,10 +41,10 @@ class CancerpredictsController < ApplicationController locale = params['data']['locale'].to_s rescue 'zh_tw' locale = 'zh_tw' if locale == 'zh_cn' result = {} - result['age1'] = -(params['data']['age'].to_f/100)**(0.5) - result['age2'] = -((params['data']['age'].to_f/100)**(0.5))*Math.log(params['data']['age'].to_f/100,Math.exp(1)) - result['size1'] = -Math.log(params['data']['size'].to_f/10,Math.exp(1)) - result['nposit'] = -((params['data']['ratio'].to_f+0.1)/0.1)**0.5 + result['age1'] = (params['data']['age'].to_f/100)**(0.5) + result['age2'] = ((params['data']['age'].to_f/100)**(0.5))*Math.log(params['data']['age'].to_f/100,Math.exp(1)) + result['size1'] = Math.log(params['data']['size'].to_f/10,Math.exp(1)) + result['nposit'] = ((params['data']['ratio'].to_f+0.1)/0.1)**0.5 if params['data']['grade'].to_i == 2 result['grade_2'] = 1 else @@ -85,7 +85,7 @@ class CancerpredictsController < ApplicationController else result['lvi_yes'] = 0 end - result['lpv'] = ((result['age1']-0.7276655)*(10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ + result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+ result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 'error') @years = ['1','3','5']