Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mluukkai committed Jun 11, 2024
1 parent 849a6ee commit 59bb8d4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions importer-db-api/src/routes/grapa/grapa.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ grapaRouter.get('/persons', async (req, res) => {
grapaRouter.get('/studytracks/:code', async (req, res) => {
const programmes = await models.Module.findAll({
where: {
code: req.params.code,
code: req.params.code
}
}).filter(p => !p.validityPeriod.endDate)

const [ studytracks ] = await sequelize.query(
const [studytracks] = await sequelize.query(
`
SELECT distinct m.name
FROM "modules" m
JOIN "studyrights" s ON m."group_id" = s.accepted_selection_path->>'educationPhase2ChildGroupId'
WHERE s.accepted_selection_path->>'educationPhase2GroupId' IN (:ids)
AND m.validity_period->>'endDate' IS NULL
`, {
`,
{
replacements: {
ids: programmes.map(p => p.groupId),
},
ids: programmes.map(p => p.groupId)
}
}
)

// filter the incomplete entries that do not have a name in all languages
res.send(studytracks.filter(st => st.name.fi && st.name.en && st.name.sv))
})


router.use('/', grapaRouter)

module.exports = router

0 comments on commit 59bb8d4

Please sign in to comment.