MCPcopy Create free account
hub / github.com/codecombat/codecombat / timeUntilResubmit

Method timeUntilResubmit

app/models/LevelSession.js:85–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83 }
84
85 timeUntilResubmit () {
86 let last, left
87 const state = (left = this.get('state')) != null ? left : {}
88 if (!(last = state.lastUnsuccessfulSubmissionTime)) { return 0 }
89 if (_.isString(last)) { last = new Date(last) }
90 // Wait at least this long before allowing submit button active again.
91 let wait = (last - new Date()) + (22 * 60 * 60 * 1000)
92 if (wait > (24 * 60 * 60 * 1000)) {
93 // System clock must've gotten busted; max out at one day's wait.
94 wait = 24 * 60 * 60 * 1000
95 state.lastUnsuccessfulSubmissionTime = new Date()
96 this.set('state', state)
97 }
98 return wait
99 }
100
101 recordScores (scores, level) {
102 let left

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected