From 05436de3094b686a420e8277e2285fa072e9eb4d Mon Sep 17 00:00:00 2001 From: soraefir Date: Sun, 25 Jun 2023 23:26:35 +0200 Subject: [PATCH] Fixed view per day overflow risk --- public/js/main.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index 1b8dfae..d1ae73e 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -136,12 +136,15 @@ const app = new Vue({ next_step: function(){ this.journey_step_data.day += 1; let s = this.journey_step_data.section; - let cd = ((this.journey_data.main[s].dateRange[1]-this.journey_data.main[s].dateRange[0])/(1000*60*60*24))+1; + let cd = this.journey_data.main[s].dateRange? + ((this.journey_data.main[s].dateRange[1]-this.journey_data.main[s].dateRange[0])/(1000*60*60*24))+1 : + 0; if(this.journey_step_data.day>cd){ this.journey_step_data.section +=1; if(this.journey_step_data.section>=this.journey_data.main.length){ - this.first_step(); + this.journey_step_data.section = this.journey_data.main.length-1; + this.journey_step_data.day = 1; }else{ this.journey_step_data.day = 1; } @@ -156,7 +159,10 @@ const app = new Vue({ this.first_step(); }else{ let s = this.journey_step_data.section; - let cd = ((this.journey_data.main[s].dateRange[1]-this.journey_data.main[s].dateRange[0])/(1000*60*60*24))+1; + + let cd = this.journey_data.main[s].dateRange? + ((this.journey_data.main[s].dateRange[1]-this.journey_data.main[s].dateRange[0])/(1000*60*60*24))+1 : + 0; this.journey_step_data.day = cd ; } }