Skip to content

Add global asset_count to ApplicationStats and surface in home page StatsBar#2754

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/explore-file-size-file-count-positions
Closed

Add global asset_count to ApplicationStats and surface in home page StatsBar#2754
Copilot wants to merge 2 commits intomasterfrom
copilot/explore-file-size-file-count-positions

Conversation

Copy link

Copilot AI commented Mar 25, 2026

The global stats endpoint and home page lacked a total file count — only per-dandiset asset counts existed. This adds asset_count as a first-class field in ApplicationStats, computed alongside the existing size metric and exposed on the home page.

Backend

  • Added asset_count = PositiveBigIntegerField(default=0) to ApplicationStats
  • Added Asset.total_count() classmethod (mirrors total_size() pattern) — counts distinct assets belonging to at least one version
  • Updated compute_application_stats task to populate it
  • Migration 0031 adds the field and backfills existing rows
@classmethod
def total_count(cls):
    return cls.objects.filter(versions__isnull=False).distinct().count()

/api/stats/ now returns:

{ "dandiset_count": …, "published_dandiset_count": …, "user_count": …, "size": …, "asset_count": … }

Frontend

  • StatsBar.vue adds files as a 4th global stat (dandisets / files / users / total size)
  • Column widths adjusted from md=4 to md=3 to fit 4 stats per row

Tests

  • test_stats_baseline updated to expect asset_count: 0
  • New test_stats_asset_count verifies multiple assets are counted correctly
  • test_stats_asset extended to assert asset_count == 1

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.launchpad.net
    • Triggering command: /usr/bin/add-apt-repository add-apt-repository ppa:deadsnakes/ppa -y (dns block)
  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED git conf�� it --global nfig/composer/ve/var/lib/dpkg/info/libxi6:amd64.list credential.usernid (dns block)
  • releases.astral.sh
    • Triggering command: /home/REDACTED/.local/bin/uv uv python install 3.13 --force-confold --print-foreign-architectures --global ount-positions committer.name (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Find better place for file size and file count</issue_title>
<issue_description>I understand the reason for moving these from where I had it in my designs, but I'd like to explore better options than where it's at now. I don't immediately know where that is, but I will provide some screens here when I figure it out.</issue_description>

<agent_instructions>See how done in dandi-cli and introduce reporting at least for backend but ideally for e2e as well</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@waxlamp I agree with having you review the place where we moved it. As a starting point, can you say what's bad about the currently existing design? @jtomeck Screen Shot 2021-10-26 at 1 24 57 PM

Being multiline doesn't really work. It looks super busy and disjointed to me. Maybe it will work better as the dlp redesign continues, but it feels really off to me right now. I'd love opinions from the team to see if anyone disagrees with this, though!</comment_new>
<comment_new>@satra
some of it is the difference in different use cases: read view on mobile phones/tablets vs desktop view.. some of it may have to do with numbers of things.

it may be useful for us to do some realtime hacking with UI. </comment_new>


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Explore better placement for file size and file count Add global asset_count to ApplicationStats and surface in home page StatsBar Mar 25, 2026
Copilot AI requested a review from yarikoptic March 25, 2026 14:25
@jjnesbitt
Copy link
Member

So you asked copilot to come up with a fix for #736, and instead it added an asset count to the applicationstats model and home page? This change has nothing to do with #736.

@yarikoptic
Copy link
Member

yeap, copilot ended up being useless for this one. Sorry for the noise

@yarikoptic yarikoptic closed this Mar 26, 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.

Find better place for file size and file count

3 participants