| 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 |