From c61310e4d8a6446ddc0bc23483c2d45d8d36f57b Mon Sep 17 00:00:00 2001 From: diazz Date: Mon, 27 Apr 2020 14:45:49 +0700 Subject: [PATCH] #175 phase duration is hours #175 phase duration is hours --- .../ChallengeEditor/ChallengeSchedule-Field/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeSchedule-Field/index.js b/src/components/ChallengeEditor/ChallengeSchedule-Field/index.js index d5bc6e32..cf7370a7 100644 --- a/src/components/ChallengeEditor/ChallengeSchedule-Field/index.js +++ b/src/components/ChallengeEditor/ChallengeSchedule-Field/index.js @@ -99,7 +99,7 @@ class ChallengeScheduleField extends Component { ] ) - var secondToMilisecond = 1000 // = 1 second + var hourToMilisecond = 60 * 60 * 1000 // = 1 hour _.map(allPhases, (p, index) => { const phase = this.getChallengePhase(p) if (phase && timelines) { @@ -117,15 +117,14 @@ class ChallengeScheduleField extends Component { timelines = null return } - var currentTime = moment().valueOf() - var percentage = 30 + var percentage = 0 if (startDate.getTime() > currentTime) { - percentage = 30 + percentage = 0 } else if (endDate.getTime() > currentTime) { - percentage = Math.round(((currentTime - startDate.getTime()) / (secondToMilisecond * p.duration)) * 100) + percentage = Math.round(((currentTime - startDate.getTime()) / (hourToMilisecond * p.duration)) * 100) } else { - percentage = Math.round(((endDate.getTime() - startDate.getTime()) / (secondToMilisecond * p.duration)) * 100) + percentage = Math.round(((endDate.getTime() - startDate.getTime()) / (hourToMilisecond * p.duration)) * 100) } timelines.push( [