Skip to content

Commit

Permalink
Expose availible PGs
Browse files Browse the repository at this point in the history
  • Loading branch information
dr3 committed Dec 5, 2022
1 parent 9da1a5c commit b50ecfe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,21 @@ app.get('/api/scores', async (req, res) => {
return res.status(200).send({ error: true });
}

const clean = getCleanAnswers(answers)
const clean = getCleanAnswers(answers);

const availablePGs = Object.entries(res.locals.pages).reduce((acc, [year, values]) => {
acc[year] = values.map(v => v.url)
return acc;
}, {});

res.status(200).send({
profileComplete: res.locals.profileComplete,
computedFullPGPoints: getPgPoints(res?.locals?.user),
level,
awardAdjustments,
answers: clean,
isTeacher
isTeacher,
availablePGs
});
});

Expand Down

0 comments on commit b50ecfe

Please sign in to comment.