Skip to content
Snippets Groups Projects

Resolve "Scoreboard in operator view"

Merged Björn Modée requested to merge 148-scoreboard into dev
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
@@ -59,7 +59,6 @@ import {
* TODO:
* - Instead of copying code for others to join the competition, copy URL.
*
* - Make code popup less code by using .map instead
*
* - Fix scoreboard
*
@@ -205,6 +204,16 @@ const OperatorViewPage: React.FC = () => {
return typeName
}
const addScore = (id: number) => {
// Sums the scores for the teams. id must be id-1 because it starts at 1
let totalScore = 0
for (let j = 0; j < teams[id - 1].question_answers.length; j++) {
totalScore = totalScore + teams[id - 1].question_answers[j].score
}
return totalScore
}
return (
<OperatorContainer>
<Dialog
@@ -364,7 +373,7 @@ const OperatorViewPage: React.FC = () => {
{teams &&
teams.map((team) => (
<ListItem key={team.id}>
{team.name} score: {'666'}
{team.name} score:{addScore(team.id)}
</ListItem>
))}
</List>
Loading