Skip to content

Commit c61310e

Browse files
committed
topcoder-platform#175 phase duration is hours
topcoder-platform#175 phase duration is hours
1 parent c8fe394 commit c61310e

File tree

1 file changed

+5
-6
lines changed
  • src/components/ChallengeEditor/ChallengeSchedule-Field

1 file changed

+5
-6
lines changed

src/components/ChallengeEditor/ChallengeSchedule-Field/index.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ChallengeScheduleField extends Component {
9999
]
100100
)
101101

102-
var secondToMilisecond = 1000 // = 1 second
102+
var hourToMilisecond = 60 * 60 * 1000 // = 1 hour
103103
_.map(allPhases, (p, index) => {
104104
const phase = this.getChallengePhase(p)
105105
if (phase && timelines) {
@@ -117,15 +117,14 @@ class ChallengeScheduleField extends Component {
117117
timelines = null
118118
return
119119
}
120-
121120
var currentTime = moment().valueOf()
122-
var percentage = 30
121+
var percentage = 0
123122
if (startDate.getTime() > currentTime) {
124-
percentage = 30
123+
percentage = 0
125124
} else if (endDate.getTime() > currentTime) {
126-
percentage = Math.round(((currentTime - startDate.getTime()) / (secondToMilisecond * p.duration)) * 100)
125+
percentage = Math.round(((currentTime - startDate.getTime()) / (hourToMilisecond * p.duration)) * 100)
127126
} else {
128-
percentage = Math.round(((endDate.getTime() - startDate.getTime()) / (secondToMilisecond * p.duration)) * 100)
127+
percentage = Math.round(((endDate.getTime() - startDate.getTime()) / (hourToMilisecond * p.duration)) * 100)
129128
}
130129
timelines.push(
131130
[

0 commit comments

Comments
 (0)