Skip to content

Download counts + Popularity sorting#439

Open
alex-taxiera wants to merge 8 commits into
chilli-axe:masterfrom
alex-taxiera:download-counts
Open

Download counts + Popularity sorting#439
alex-taxiera wants to merge 8 commits into
chilli-axe:masterfrom
alex-taxiera:download-counts

Conversation

@alex-taxiera

@alex-taxiera alex-taxiera commented May 16, 2026

Copy link
Copy Markdown
Contributor

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.

image

Checklist

  • I have installed pre-commit and installed the hooks with pre-commit install before creating any commits.
  • I have updated any related tests for code I modified or added new tests where appropriate.
  • I have manually tested my changes as follows:
    • downloaded some cards over two days
    • checked sorting for daily, weekly, and all time
  • I have updated any relevant documentation or created new documentation where appropriate.

…ewCardsPage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@ndepaola ndepaola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread MPCAutofill/cardpicker/views.py Outdated
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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ let's see if we can do this in one query

Comment thread MPCAutofill/cardpicker/schema_types.py Outdated
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer to nest these new properties under a new "downloads" key, which should be optional for backwards compatibility

Comment thread MPCAutofill/cardpicker/documents.py Outdated
)

def prepare_downloads_this_month(self, instance: Card) -> int:
from datetime import date

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer imports at top of module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants