crates.io icon indicating copy to clipboard operation
crates.io copied to clipboard

controllers/crates: default to sort by recent downloads

Open punkeel opened this issue 1 year ago • 2 comments

"Browse All Crates" is the most prominent link in the menu bar, displayed on all pages. Before this change, this link would present the user with (mostly) irrelevant crates, as it was sorted alphabetically: crates like a, a-, a0, etc.

With this change, the list is now sorted to present the most downloaded crates first.

/keywords/:term already defaults to that same order.

punkeel avatar Jan 07 '24 13:01 punkeel

@punkeel it looks like a couple of tests are failing though. could you take a look?

Turbo87 avatar Jan 07 '24 14:01 Turbo87

Digging into the failure a bit further, to make the test pass, you need to:

  1. Make the response reflect the sorting method: Add support for sorting by recent-downloads in the mirage/route-handlers/crates.js file.
  2. Update the corresponding assert value: Since the default sorting method has now changed to recent-downloads, we need to update crates sort, All-Time and Recent values in the tests/acceptance/crates-test.js file accordingly.

eth3lbert avatar Feb 20 '24 20:02 eth3lbert

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.06%. Comparing base (b6ddda3) to head (39a2ff0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7889      +/-   ##
==========================================
+ Coverage   89.04%   89.06%   +0.02%     
==========================================
  Files         278      278              
  Lines       27987    27987              
==========================================
+ Hits        24922    24928       +6     
+ Misses       3065     3059       -6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 06 '24 12:07 codecov[bot]