@@ -38,7 +38,9 @@ let votingStartTime = moment("3 May 2021 08:00:00 CDT");
3838let votingEndTime = moment ( "7 May 2021 23:59:59 CDT" ) ;
3939
4040// easy route testing by passing a date string below
41- let now = moment ( ) ;
41+ const now = function ( ) {
42+ return moment ( ) ;
43+ } ;
4244
4345const routes = [
4446 // testing route
@@ -152,12 +154,12 @@ const routes = [
152154 name : "voting" ,
153155 component : ( ) => {
154156 // show VoteWoah if before vote start time
155- if ( now < votingStartTime ) {
157+ if ( now ( ) < votingStartTime ) {
156158 return import ( "@/views/Voting/VoteWoah" ) ;
157159 }
158160
159161 // show VotingOver if past vote end time
160- if ( now > votingEndTime ) {
162+ if ( now ( ) > votingEndTime ) {
161163 // TODO: add a leaderboard here once built
162164 return import ( "@/views/Voting/VotingOver" ) ;
163165 }
@@ -179,13 +181,16 @@ const routes = [
179181 name : "quiz" ,
180182 component : async ( ) => {
181183 // time before challenge has started
182- if ( now < mainQuestionsStartTime ) {
184+ if ( now ( ) < mainQuestionsStartTime ) {
183185 // TODO: update QuizCountdown's content for 2022's before start time
184186 return import ( "@/views/Quiz/QuizCountdown" ) ;
185187 }
186188
187189 // time during main quiz
188- if ( now >= mainQuestionsStartTime && now <= mainQuestionsEndTime ) {
190+ if (
191+ now ( ) >= mainQuestionsStartTime &&
192+ now ( ) <= mainQuestionsEndTime
193+ ) {
189194 // USER HAS FINISHED QUIZ
190195 // TODO: for 2022 import a 'you finished now wait for boss' component
191196 // if done will all questions except boss
@@ -195,15 +200,15 @@ const routes = [
195200 }
196201
197202 // time between main questions ending and boss starting
198- if ( now > mainQuestionsEndTime && now < bossStartTime ) {
203+ if ( now ( ) > mainQuestionsEndTime && now ( ) < bossStartTime ) {
199204 // TODO: for 2022 make an await final boss component, or start passing props to QuizCountdown
200205
201206 // MUST WAIT FOR NEXT QUESTION
202207 return import ( "@/views/Quiz/QuizCountdown" ) ;
203208 }
204209
205210 // time during boss final question
206- if ( now >= bossStartTime && now <= bossEndTime ) {
211+ if ( now ( ) >= bossStartTime && now ( ) <= bossEndTime ) {
207212 // User did not make the cut
208213 if (
209214 store . state . Quiz . rankToday == store . state . Quiz . maxRank &&
@@ -224,7 +229,7 @@ const routes = [
224229 }
225230
226231 // time after boss question ends and before voting
227- if ( now > bossEndTime && now < votingStartTime ) {
232+ if ( now ( ) > bossEndTime && now ( ) < votingStartTime ) {
228233 // user has finished the boss question
229234 if ( store . state . Quiz . maxRank === store . state . User . rank - 1 ) {
230235 return import ( "@/views/Quiz/QuizFinished" ) ;
@@ -239,7 +244,7 @@ const routes = [
239244 } ,
240245 beforeEnter ( from , to , next ) {
241246 // redirect if all sections of quiz are over
242- if ( now >= votingStartTime ) {
247+ if ( now ( ) >= votingStartTime ) {
243248 next ( "/voting" ) ;
244249 }
245250
0 commit comments