Skip to content
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

optimise performance of tag_controller show #8073

Merged
merged 1 commit into from
Jun 24, 2020

Conversation

Tlazypanda
Copy link
Collaborator

@Tlazypanda Tlazypanda commented Jun 24, 2020

Fixes #8072

optimised performance of tag_controller show by replacing .length>0 with size.positive? so that sql queries are not repeated and response time is reduced.

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

Screenshots

Before

tagshow_before
After

tagshow_after

Thanks!

@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #8073 into master will increase coverage by 1.88%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8073      +/-   ##
==========================================
+ Coverage   80.52%   82.41%   +1.88%     
==========================================
  Files          99       99              
  Lines        5757     5737      -20     
==========================================
+ Hits         4636     4728      +92     
+ Misses       1121     1009     -112     
Impacted Files Coverage Δ
app/controllers/tag_controller.rb 81.40% <100.00%> (+5.48%) ⬆️
app/models/node.rb 91.07% <0.00%> (+0.36%) ⬆️
app/api/srch/search.rb 66.24% <0.00%> (+0.63%) ⬆️
app/controllers/users_controller.rb 82.29% <0.00%> (+1.04%) ⬆️
app/helpers/application_helper.rb 84.52% <0.00%> (+1.19%) ⬆️
app/controllers/admin_controller.rb 79.74% <0.00%> (+1.68%) ⬆️
app/controllers/search_controller.rb 97.67% <0.00%> (+2.32%) ⬆️
app/controllers/wiki_controller.rb 85.00% <0.00%> (+3.07%) ⬆️
app/models/concerns/node_shared.rb 90.29% <0.00%> (+3.39%) ⬆️
... and 8 more

@Tlazypanda
Copy link
Collaborator Author

Hey @jywarren @cesswairimu can you kindly review? Thanks ✌️

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

Wow, how cool. Love the quantitative approach here!!!

@jywarren jywarren merged commit 57fc3be into publiclab:master Jun 24, 2020
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.

Optimise the TagController#show ORM query
2 participants