Skip to content

Conversation

@patrickcuagan
Copy link
Collaborator

Ticket: https://torchbox.atlassian.net/browse/R1-269

This PR implements pulling in of scholarship snippets to programme pages.

Screenshot 2025-10-30 at 9 57 52 AM

…gible programme for a scholarship shnippet
@patrickcuagan patrickcuagan force-pushed the feature/269-scholarships-in-programme-pages branch from 56f0784 to 7510efb Compare October 30, 2025 02:02
Comment on lines 1118 to 1137
if self.scholarship_set.exists():
return [
{
"value": {
"heading": s.title,
"introduction": s.summary,
"eligible_programmes": ", ".join(
str(x) for x in s.eligable_programmes.live()
),
"funding_categories": ", ".join(
x.title for x in s.funding_categories.all()
),
"fee_statuses": ", ".join(
x.title for x in s.fee_statuses.all()
),
"value": s.value,
}
}
for s in self.scholarship_set.all()
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: I think there is N+1 problem here.
If a programme has 10 scholarships, you're making:
1 query to get scholarships
10 queries for eligible_programmes
10 queries for funding_categories
10 queries for fee_statuses

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks. Good catch! I've updated this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants