Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

bring master up to date #70

Merged
merged 9 commits into from
Nov 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
sorting on final score
  • Loading branch information
Dushyant Bhalgami committed Nov 16, 2019
commit 61abe8a6a1720e26f48ffb2e2b1baa2237bc07af
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"express": "^4.16.4",
"express-session": "^1.17.0",
"isomorphic-unfetch": "^3.0.0",
"lodash": "^4.17.15",
"next": "^7.0.2",
"prop-types": "^15.6.2",
"react": "^16.5.2",
Expand Down
28 changes: 1 addition & 27 deletions pages/problem-statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,36 +115,12 @@ class ProblemStatement extends React.Component {
})

this.setState({ leaderboard })

this.polling = setTimeout(this.displayFinalScores, publicRuntimeConfig.processDevRevealDelay)
} else {
this.setState({ leaderboard })
// Poll after configured second
this.polling = setTimeout(this.setupLeaderboard, publicRuntimeConfig.pollTimeInterval)
}

// if (!finalResultsAvailable) {
// this.setState({ leaderboard })
// // Poll after configured second
// this.polling = setTimeout(this.setupLeaderboard, publicRuntimeConfig.pollTimeInterval)
// } else {
// this.finalLeaderboard = JSON.parse(JSON.stringify(leaderboard))

// leaderboard = leaderboard.map(l => {
// const member = {
// handle: l.handle,
// profilePic: l.profilePic,
// countryFlag: l.countryFlag,
// status: 'Processing final scores...',
// statusAnimationClass: 'animate flash infinite'
// }
// return member
// })

// this.setState({ leaderboard })

// this.polling = setTimeout(this.displayFinalScores, publicRuntimeConfig.processDevRevealDelay)
// }
})
.catch((err) => {
console.log('Failed to fetch leaderboard. Error details follow')
Expand All @@ -168,6 +144,7 @@ class ProblemStatement extends React.Component {
}
}

this.finalLeaderboard.sort((a, b) => (b.finalDetails.aggregateScore - a.finalDetails.aggregateScore))
const leaderboardLength = leaderboard.length

for (let i = 0; i < this.finalLeaderboard.length - leaderboardLength; i++) {
Expand All @@ -180,10 +157,7 @@ class ProblemStatement extends React.Component {
})
}

console.log(leaderboard)

leaderboard.reverse()

this.setState({ leaderboard })

if (!noMoreToReveal) {
Expand Down