Closed
Description
Instructions for fixing this, can be done in 2 separate PRs but they will need to be done in order :)
PR 1: backend
- In the
summary
function that returns JSON for the /api/v1/summary route, add a query similar to these queries that selects 10 crates sorted by recent downloads descending nulls last, which is defined by this query that's part of theindex
function (I'm fine with copy-pasting that code, if you feel ambitious and want to refactor to remove the duplication, feel free to give that a try!) - Add a field for those crates to the returned data struct definition and the returned struct instance in the same manner as the other fields that return crates
- Add a test that 2 or 3 crates are returned in the expected order for this field, the
CrateBuilder
provides a way to set a crate's recent downloads for testing. The summary route isn't tested very much right now; a bonus would be adding more tests for the other parts of summary as well!
PR #2: Frontend
- Once /api/v1/summary returns recent downloads, add a section like these to display recent downloads. Please think of a good header for this, "Most Recently Downloaded" sounds like this is what crates people have downloaded in the last minute? "Most Downloaded in the Last 90 Days" is accurate but long. "Most Recent Downloads"? "Most Downloads Recently"?
- Check how it looks and at different browser widths; I think the CSS should Just Work but there's a chance it might need some tweaks :)