From b50ecfe3e016884417e4aea5a93bc20f087d0b7e Mon Sep 17 00:00:00 2001 From: Drew McMillan Date: Mon, 5 Dec 2022 15:44:09 +0000 Subject: [PATCH] Expose availible PGs --- functions/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/index.js b/functions/index.js index bed5e436..92fe643a 100644 --- a/functions/index.js +++ b/functions/index.js @@ -129,7 +129,12 @@ 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, @@ -137,7 +142,8 @@ app.get('/api/scores', async (req, res) => { level, awardAdjustments, answers: clean, - isTeacher + isTeacher, + availablePGs }); });