Skip to content

Task: portal balance widget — leaderboard mode #6

@avandenberghe

Description

@avandenberghe

Follow-up of avatharbe/bbAccounts-dev#83. Adds the second render mode envisioned in avatharbe/bbAccounts-dev#79 surface 4 (leaderboard) on top of the own-balance variant that shipped with avatharbe/bbAccounts-dev#83.

Scope

Per portal block instance, an admin chooses:

  • the account_id whose balances to surface
  • N (top-N members)

Block renders the top-N subledger balances on that account, descending by closing balance. Visible to all viewers; the data is whatever the admin chose to make public.

Per-instance config

bbGuild already has `bb_portal_config` for per-module-id key/value config. The leaderboard mode persists `account_id` and `top_n` there, edited via the bbGuild ACP portal screen's module-config form.

The own-balance mode (shipped) needs no config — keep it as the default. Adding leaderboard means the module's `get_template_acp()` returns a mode picker (own-balance / leaderboard) plus, when leaderboard is selected, an account_id dropdown and a top_n integer.

Files

  • `portal/module/bbaccounts_balance.php` — extend `prepare_template()` to branch on the configured mode; add `get_template_acp()`
  • New service method on `balance_summary` (or a sibling service) for top-N-on-account aggregation — keeps the SQL out of the portal module.
  • `styles/prosilver/template/portal/bbaccounts_balance.html` — add a leaderboard-result branch
  • `language/en/portal_bbaccounts.php` — heading, table headers, "configure account" prompt

Acceptance

  • Mode selector visible in the bbGuild ACP portal block-config form.
  • Leaderboard mode renders the top-N on the configured account.
  • Anonymous viewers can see leaderboard data (the public mode); own-balance mode continues to require `u_accounts_view_own`.
  • No new ledger service methods — top-N reuses existing per-account aggregate queries.

Notes

This was originally part of avatharbe/bbAccounts-dev#83's scope but the own-balance variant ships first because it's the higher-value path and adds zero ACP plumbing. Leaderboard adds the per-instance config story that bbGuild's portal supports but that avatharbe/bbAccounts-dev#83 didn't need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions