Download counts + Popularity sorting#439
Open
alex-taxiera wants to merge 8 commits into
Open
Conversation
…ewCardsPage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ndepaola
reviewed
May 16, 2026
ndepaola
left a comment
Collaborator
There was a problem hiding this comment.
thanks for this!! i'm out atm but have left a couple of initial thoughts.
data types shared by frontend/backend are defined in /schemas as JSON files. after updating a schema you should npm run build in /schemas to generate the corresponding python and typescript code
make sure to install pre-commit because the codegen process fucks with import/styling conventions
| today = date.today() | ||
| card_ids = list(Card.objects.filter(identifier__in=body.cardIdentifiers).values_list("id", flat=True)) | ||
| with connection.cursor() as cursor: | ||
| for card_id in card_ids: |
Collaborator
There was a problem hiding this comment.
❌ let's see if we can do this in one query
| result["sourceName"] = from_str(self.sourceName) | ||
| result["sourceVerbose"] = from_str(self.sourceVerbose) | ||
| result["tags"] = from_list(from_str, self.tags) | ||
| result["downloadsToday"] = from_int(self.downloadsToday) |
Collaborator
There was a problem hiding this comment.
would prefer to nest these new properties under a new "downloads" key, which should be optional for backwards compatibility
| ) | ||
|
|
||
| def prepare_downloads_this_month(self, instance: Card) -> int: | ||
| from datetime import date |
Collaborator
There was a problem hiding this comment.
prefer imports at top of module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added download tracking with a daily bucket system
Added new sorting options based on the download counts called "popularity"
Willing to do more, or less, with this PR so let me know if there are any other ideas.
Checklist
pre-commitand installed the hooks withpre-commit installbefore creating any commits.