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

change ordering, include distributions in search, include totalcount #1661

Merged
merged 6 commits into from
Jan 11, 2021

Conversation

Kicksta
Copy link
Contributor

@Kicksta Kicksta commented Dec 18, 2020

No description provided.

@codecov
Copy link

codecov bot commented Dec 18, 2020

Codecov Report

Merging #1661 (a67dfc6) into master (57f803f) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1661      +/-   ##
==========================================
- Coverage   94.89%   94.89%   -0.01%     
==========================================
  Files         555      555              
  Lines       23435    23545     +110     
==========================================
+ Hits        22239    22342     +103     
- Misses       1196     1203       +7     
Impacted Files Coverage Δ
app/grandchallenge/products/views.py 78.57% <100.00%> (+0.22%) ⬆️
app/config/settings.py 93.61% <0.00%> (-0.93%) ⬇️
app/grandchallenge/cases/urls.py 100.00% <0.00%> (ø)
app/tests/cases_tests/test_views.py 100.00% <0.00%> (ø)
app/grandchallenge/cases/views.py 94.77% <0.00%> (+0.26%) ⬆️
app/grandchallenge/cases/admin.py 84.46% <0.00%> (+1.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57f803f...a67dfc6. Read the comment docs.

@Kicksta
Copy link
Contributor Author

Kicksta commented Dec 18, 2020

Since moving to WSL2, I am using VS code and I haven't got black and flake8 configured. Will try to get that back in place and recommit.

Copy link
Member

@jmsmkn jmsmkn left a comment

Choose a reason for hiding this comment

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

I've made a few suggestions that should reduce the number of database calls for this as every time you call queryset.count() the query is executed. Please check if it works as intended when they're all applied.

What I've changed it to - we store the count of the unfiltered queryset on the view object in L30, then filter it in the rest of get_queryset, then lookup the number again in L126.

app/grandchallenge/products/views.py Outdated Show resolved Hide resolved
app/grandchallenge/products/views.py Outdated Show resolved Hide resolved
app/grandchallenge/products/views.py Outdated Show resolved Hide resolved
app/grandchallenge/products/views.py Outdated Show resolved Hide resolved
@jmsmkn
Copy link
Member

jmsmkn commented Jan 7, 2021

Did this work? I was making the suggestions blind. Also, did you get pre-commit set back up?

@Kicksta
Copy link
Contributor Author

Kicksta commented Jan 7, 2021

The code worked, checked it before the holidays, but I am having trouble with pre-commit. If I understand correctly it isn't available for Ubuntu 20.04. So after some googling figured out I could use snap for it. But using snap install pre-commit gives the following: error: cannot communicate with server: Post http://localhost/v2/snaps/pre-commit: dial unix /run/snapd.socket: connect: no such file or directory Now I have found two options of which both I am not sure what they do and I am somewhat hesitant to give them a try, however it seems to help people with similar issues: option 1, option 2. Any advice on which one to try while not breaking things...?

@jmsmkn
Copy link
Member

jmsmkn commented Jan 7, 2021

The best way is via pip, they provide a single command to set everything up

curl https://pre-commit.com/install-local.py | python -

See https://pre-commit.com/#installation

@jmsmkn jmsmkn merged commit 30e51fe into master Jan 11, 2021
@jmsmkn jmsmkn deleted the productlist_optimize branch January 11, 2021 13:56
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.

2 participants