Skip to content

Commit

Permalink
feat: update the grapa studytrack query to select distinct based on t…
Browse files Browse the repository at this point in the history
…he finnish name
  • Loading branch information
HRemonen committed Dec 12, 2024
1 parent c876f75 commit 3e4fe82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions importer-db-api/src/routes/grapa/grapa.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ grapaRouter.get('/studytracks', async (req, res) => {

const [studytracks] = await sequelize.query(
`
SELECT distinct on (m.name) m.name, m.id, m.validity_period, s.accepted_selection_path->>'educationPhase2GroupId' as "programGroupId"
SELECT distinct on (lower(m.name->>'fi')) m.name, m.id, s.accepted_selection_path->>'educationPhase2GroupId' as "programGroupId"
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
AND s.document_state = 'ACTIVE'
ORDER BY m.name, m.validity_period DESC
ORDER BY lower(m.name->>'fi'), m.validity_period DESC
LIMIT :limit OFFSET :offset
`,
{
Expand Down

0 comments on commit 3e4fe82

Please sign in to comment.