-
Notifications
You must be signed in to change notification settings - Fork 645
Add recent downloads #892
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
Add recent downloads #892
Conversation
@natboehm: Could you run a |
@vignesh-sankaran forgot about that one, will do! |
@natboehm Thanks for that :). Which version of Diesel were you waiting on in order for this PR to work? |
@vignesh-sankaran not sure about the version but I think we're waiting on this PR to be merged. |
I'm going to release tomorrow |
@sgrif Were you also going to update the Diesel version that crates.io specifies? |
@natboehm If you rebase you should have everything you need now |
c6719b7
to
7648e13
Compare
7648e13
to
28c1bbd
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.
Overall this is looking great!!!! This was a lot of work, good job!!!
I've got a few small comments, and there's also:
- A clippy failure i think we should allow for now
- A problem with nulls i'll talk to you about in a second - add
NULLS LAST
to the ordering by recent downloads sql and add a test - A few commit messages that can be cleaned up
src/tests/all.rs
Outdated
@@ -1,4 +1,4 @@ | |||
#![deny(warnings)] | |||
//#![deny(warnings)] |
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.
Could you put this back please ❤️ :)
page: { refreshedModel: true }, | ||
sort: { refreshedModel: true }, | ||
page: { refreshModel: true }, | ||
sort: { refreshModel: true }, |
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.
I have no idea how you figured out this was needed; I don't think I could have!!! I'm super impressed!!! 😻
tests/acceptance/crates-test.js
Outdated
|
||
await visit('/crates'); | ||
const $recentDownloads = findWithAssert('div.recent-downloads:first span.num'); | ||
hasText(assert, $recentDownloads, 'Recent:'); |
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.
Is this test's expected text meant to have a number in it like the assertion on line 61 does?
app/controllers/category/index.js
Outdated
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; | ||
if (this.get('sort') === 'downloads') { | ||
return 'All-Time Downloads'; | ||
} else if (this.get('sort') === 'recent-downloads') { |
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.
WDYT about removing the explicit check for 'recent-downloads' and letting the else
case handle that here? Kind of like the default Alphabetical
in app/controllers/crates.js?
app/styles/crate.scss
Outdated
.recent-downloads { | ||
@include display-flex; | ||
@include align-items(center); | ||
|
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.
Nitpicky: could you remove this empty line please? :)
src/krate.rs
Outdated
@@ -39,7 +40,17 @@ use util::{RequestUtils, CargoResult, internal, ChainError, human}; | |||
use version::{EncodableVersion, NewVersion}; | |||
use {Model, User, Keyword, Version, Category, Badge, Replica}; | |||
|
|||
#[derive(Debug, Clone, Queryable, Identifiable, AsChangeset)] | |||
#[derive(Insertable, Queryable, Identifiable, Associations, AsChangeset)] |
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.
Could you add Debug
here please? I like having debug on all the things :) hmmmm I think sgrif told me there was a lint for this....
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.
#![deny(missing_debug_implementations, missing_copy_implementations)]
😄
…oth totals are listed but has ability to show just one according to sort
…me downloads in results
… of crates displayed
…relevance with search query
…page are default sorted by recent downloads
…st of crates returned is sorted by recent-downloads
…t to recent-downloads
… to recent-downloads
e094f52
to
1acfbef
Compare
…=cargo-clippy to feature=clippy)
This addresses issue #702, sorting crates by downloads in the past 90 days. The implementation follows Option 2 detailed in the issue, adding a new option to all sorting menus for downloads in the last 90 days and keeping the option to sort by all-time downloads. The number of recent downloads has been added to display below all-time downloads next to each crate, labeled accordingly.
This PR is currently waiting on updates to Diesel, without which it will not function correctly.
( edit: updates to Diesel complete :) )
Fixes #702