Skip to content
Snippets Groups Projects
Commit 4a16057a authored by L4168's avatar L4168
Browse files

format score return for replay

parent ade9ca1d
No related branches found
No related tags found
3 merge requests!59Development to master,!54Development to testing,!50Mockdata replay
......@@ -93,17 +93,25 @@ export class ReplayService {
//
// this block returns all score data from the game
//
let scores = await this.scoreRepository.find({
where: { faction: In(factionIds) },
relations: ['faction'],
});
let currentScore = scores.map(score => {
return {
score: score.score,
timestamp: score.scoreTimeStamp,
faction: score.faction['factionName'],
};
});
let currentScore = [];
await Promise.all(
factions.map(async faction => {
let scores = await this.scoreRepository.find({
where: { faction: faction },
relations: ['faction'],
});
currentScore.push(
scores.map(score => {
return {
score: score.score,
timestamp: score.scoreTimeStamp,
faction: score.faction['factionName'],
};
}),
);
}),
);
console.log(currentScore);
return {
players: currentdata,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment