-
Notifications
You must be signed in to change notification settings - Fork 649
Show and sort by downloads on reverse dependency page #531
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
Conversation
@carols10cents Ok, it works now. I had to abuse the CI because the tests won't run on my machine. |
@LeopoldArkham Hm, why doesn't the ordering in SQL work? |
@carols10cents Whenever a query contains a So since we're DISTINCT ON crate_name, I can only ORDER BY crate_name. I think it would be possible to do in all SQL with a sub-query, but this seemed like a clearer and more maintainable way. If there's a policy against this (or I'm missing something), I can go back and look into it. (Didn't mean to close) |
Oh! There's no policy or anything, it's just that SQL is really good at ordering things really fast :) So the reason a reverse dependency might be duplicated is if a crate lists another crate as a dependency multiple times, such as target-specific dependencies. So for crate A, it might depend on crate B twice, so crate B's reverse dependencies would have duplicate listing of A. However, in both listings of A, the number of crates.downloads for A will be the same. So we should be able to add crate_downloads to the list of columns specified in the DISTINCT clause, and meet the necessary criteria for the ordering, like this:
What do you think? Is there anything I'm missing? (it's entirely possible!) |
No, you're totally right, thank you! I had misunderstood the behavior of I also got the test suite to (mostly) work, so we should be OK. |
^ I jinxed myself. |
Looks great, works like a charm!!! 🍀 Sorry I took so long to review this, thank you for your patience!! ❤️ |
And you for yours! |
Fixes #495
I swapped the redundant arrow link on the right for the download count, I don't think anybody used it (?).