Skip to content

Conversation

@rhian-cs
Copy link
Contributor

Resolves #2373

Description

In the dashboard page, bullet was reporting some optimization to be done in the database queries that were used. I removed all of the warnings, by removing the unnecessary queries and adding the missing ones.

Type of change

  • Tech debt

How Has This Been Tested?

For the bullet warnings themselves, I manually tested if the warnings still showed up in the dashboard.

bullet also supports a configuration that makes a spec fail if a bullet warning is raised:

# config/environments/development.rb
...
config.after_initialize do
  ...
  Bullet.raise = true
end

This could be useful in the future, but it can be kind of confusing for beginners and it would require fixing all of the bullet warnings first.

I also had to change a scope in the Donation model to add an includes call. To make sure this change was safe, I improved the tests for this scope.

Screenshots

No bullet warnings are shown anymore, yay \o/
image

Copy link
Collaborator

@edwinthinks edwinthinks left a comment

Choose a reason for hiding this comment

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

Thank you! This is great

@edwinthinks edwinthinks merged commit 1804833 into rubyforgood:main Jun 23, 2021
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.

Address N+1 issues detected by bullet on the dashboard

2 participants