Skip to content

Show release download totals - #21

Merged
masonasons merged 1 commit into
masonasons:masterfrom
kellylford:feature/release-download-totals
Jul 30, 2026
Merged

Show release download totals#21
masonasons merged 1 commit into
masonasons:masterfrom
kellylford:feature/release-download-totals

Conversation

@kellylford

Copy link
Copy Markdown
Contributor

Implements #20, which you gave the go-ahead on. Scope is exactly what was proposed there — nothing extra.

The gap

FastGH already parses download_count and ReleaseAsset.format_display() already shows it per file. What was missing was any total, so a release never displayed a download number anywhere — you had to open a release and add its asset counts up by hand.

What this does

models/release.py

  • New Release.total_downloads property, summing the assets.
  • New format_downloads() handling singular/plural, worded to match the existing ReleaseAsset.format_display().
  • format_display() now reads (8 assets, 194 downloads).

GUI/releases.py

  • A Downloads: line next to the existing Assets: line in the releases-list preview pane.
  • Downloads: N across N assets in the release details dialog.

One judgement call

The download figure is omitted when a release has no assets, rather than showing (0 assets, 0 downloads).

Releases carrying only the auto-generated "Source code (zip/tar.gz)" links are common, and those are not assets — GitHub does not count them and never reports a number for them. So on those releases a 0 downloads would be permanent noise on every row rather than information. With assets present, 0 downloads is shown, because that is a real and sometimes interesting result. Same rule in all three places, and both behaviours are covered by tests.

Happy to always show it instead if you'd prefer the simpler rule.

Verification

  • 928 tests pass (python -m pytest tests/), 67 in test_models_release.py, of which 12 are new.
  • New tests cover the sum, a single asset, no assets, all-zero counts, download_count absent from the API payload, singular/plural wording, and format_display() both including and omitting the count.
  • Confirmed the three existing format_display tests still hold — the added text does not disturb the "1 asset" / "1 assets" assertions.
  • Also ran real API payloads through Release.from_github_api rather than testing only against fixtures:
v0.8.36: QuickMail v0.8.36 - Release (8 assets, 194 downloads) - 5d ago
v0.8.35: QuickMail v0.8.35 - Release (8 assets, 225 downloads) - 6d ago
v0.8.34: QuickMail v0.8.34 - Release (8 assets, 335 downloads) - 1w ago

Not included

Per #20, and left as your design calls: a repo-wide total across releases, and reordering the assets list by download count (that one changes existing behaviour).

FastGH already parses each asset's download_count and shows it per file,
but nothing totalled it, so a release never displayed a download number.
Finding out how many times a release was downloaded meant opening it and
adding the asset counts up by hand.

- models/release.py: new Release.total_downloads property (sums the
  assets) and format_downloads() for singular/plural, matching the
  existing ReleaseAsset.format_display() wording. format_display() now
  reads "(8 assets, 194 downloads)". The download part is omitted when a
  release has no assets, so releases carrying only the auto-generated
  source archives are not padded with a meaningless "0 downloads" —
  source archives are not assets and GitHub never counts them.
- GUI/releases.py: a "Downloads:" line beside the existing "Assets:"
  line in the releases-list preview pane, and "Downloads: N across N
  assets" in the release details dialog. Both are omitted when the
  release has no assets.
- tests: 12 tests covering the total (sum, single asset, no assets, all
  zero, download_count absent from the API payload), the singular/plural
  wording, and format_display both including and omitting the count.

Deliberately not included: a repo-wide total across releases, and
reordering the assets list by download count. Both were raised in masonasons#20 as
design calls rather than part of this change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@masonasons
masonasons merged commit cd28436 into masonasons:master Jul 30, 2026
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