-
Notifications
You must be signed in to change notification settings - Fork 2
Administrate improvement and updates #2436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ing hubs and hub regions as they are not currently used on teach computing after April 1st 2025.
…activity groupings, pathways and assessments - if any Minor improvements to the reports dashboard
a118f38
to
4100fe4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One micro-optimisation of note, but otherwise this looks good to me. Thanks Adam!
<% @programme.pathways.each do |pathway| %> | ||
<tr> | ||
<td><%= pathway.title %></td> | ||
<td><%= pathway.pathway_activities.count %></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using .count
on an association you've eager loaded will be triggering an extra SQL query unnecessarily. In Rails it's best to prefer .size
over .count
as the former will first check if the collection has already been loaded into memory, and count that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good tip, I'll update this to .size
, thanks Barry!
@programmes = [ | ||
Programme.cs_accelerator, | ||
Programme.primary_certificate, | ||
Programme.secondary_certificate, | ||
Programme.i_belong, | ||
Programme.a_level | ||
].compact.sort_by(&:title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This raised an eyebrow at first, but I then realised this is just 5 records being sorted in memory, not 5 sets of records.
|
Status
Review progress:
What's changed?
Steps to perform after deploying to production
If the production environment requires any extra work after this PR has been deployed detail it here. This could be running a Rake task, migrating a DB table, or upgrading a Gem. That kind of thing.