Add to the series view command the completion progress number to the title #540

Open
opened 2026-09-25 12:50:58 +01:00 by Vylpes · 7 comments
Owner

Like how we have on the series list

Why

/series list shows per-series claim progress as (owned/total) on each line (SeriesHelper.GenerateSeriesListPage). /series view embed title is only the series name today (GenerateSeriesViewPage), so players must infer progress from inventory elsewhere.

Scope

In scope: Discord /series view embed (all card pages) and pagination buttons — add per-series completion in the embed title, using the same inventory rules as the matching line on /series list.

Out of scope: Global catalog completion on /series list (#539); changing list line format; changing card grid description lines; web/management UI.

Acceptance criteria

  • GIVEN a user opens /series view for a series (or paginates with Previous/Next)
    WHEN GenerateSeriesViewPage builds the embed
    THEN the embed title includes that series’ completion percentage (not just the bare series name).

  • GIVEN the user’s inventory is loaded for the view
    WHEN owned/total are computed for the viewed series
    THEN owned = count of inventory rows whose CardNumber appears in that series’ cards list (duplicate copies of the same card count once); total = series.cards.length — matching the (owned/total) logic on the corresponding /series list line.

  • GIVEN owned and total for the series
    WHEN the percentage is shown in the title
    THEN it is a whole number 0–100 using Math.round(100 * owned / total), and total = 0 is handled without division errors (show 0%).

  • GIVEN the title is rendered
    WHEN a user reads it
    THEN it follows the same pattern as the global list title in #539, e.g. {series.name} — 67% complete.

  • GIVEN the user paginates within the same series
    WHEN they move between card pages
    THEN the title percentage (and series name) stay identical on every page; only the card grid image/description and page footer text change.

  • GIVEN automated tests for GenerateSeriesViewPage
    WHEN CI runs
    THEN tests cover at least: no claims (0%); partial series completion; full series (100%); pagination does not alter title progress.

Subtasks

  • Load user inventory in GenerateSeriesViewPage and compute per-series owned/total (reuse or extract shared helper with list line logic / #539 work where practical)
  • Update view embed title to {series.name} — {n}% complete
  • Extend tests/helpers/SeriesHelper.test.ts for view title progress + pagination invariants
  • Add a CHANGELOG entry under the target release for series view title progress

Notes

  • Pairs with #539 (global % on /series list title); no hard dependency — can ship independently.
  • Per-series (owned/total) on list lines shipped in 0.10.0; this story adds percentage in the view title only.
Like how we have on the series list ## Why `/series list` shows per-series claim progress as `(owned/total)` on each line (`SeriesHelper.GenerateSeriesListPage`). `/series view` embed title is only the series name today (`GenerateSeriesViewPage`), so players must infer progress from inventory elsewhere. ## Scope **In scope:** Discord `/series view` embed (all card pages) and pagination buttons — add **per-series** completion in the embed **title**, using the same inventory rules as the matching line on `/series list`. **Out of scope:** Global catalog completion on `/series list` ([#539](https://git.vylpes.xyz/External/card-drop/issues/539)); changing list line format; changing card grid description lines; web/management UI. ## Acceptance criteria - **GIVEN** a user opens `/series view` for a series (or paginates with Previous/Next) **WHEN** `GenerateSeriesViewPage` builds the embed **THEN** the embed **title** includes that series’ completion **percentage** (not just the bare series name). - **GIVEN** the user’s inventory is loaded for the view **WHEN** owned/total are computed for the viewed series **THEN** **owned** = count of inventory rows whose `CardNumber` appears in that series’ `cards` list (duplicate copies of the same card count once); **total** = `series.cards.length` — matching the `(owned/total)` logic on the corresponding `/series list` line. - **GIVEN** owned and total for the series **WHEN** the percentage is shown in the title **THEN** it is a whole number **0–100** using `Math.round(100 * owned / total)`, and **total = 0** is handled without division errors (show **0%**). - **GIVEN** the title is rendered **WHEN** a user reads it **THEN** it follows the same pattern as the global list title in [#539](https://git.vylpes.xyz/External/card-drop/issues/539), e.g. `{series.name} — 67% complete`. - **GIVEN** the user paginates within the same series **WHEN** they move between card pages **THEN** the title percentage (and series name) stay **identical** on every page; only the card grid image/description and page footer text change. - **GIVEN** automated tests for `GenerateSeriesViewPage` **WHEN** CI runs **THEN** tests cover at least: no claims (0%); partial series completion; full series (100%); pagination does not alter title progress. ## Subtasks - [x] Load user inventory in `GenerateSeriesViewPage` and compute per-series owned/total (reuse or extract shared helper with list line logic / [#539](https://git.vylpes.xyz/External/card-drop/issues/539) work where practical) - [x] Update view embed title to `{series.name} — {n}% complete` - [x] Extend `tests/helpers/SeriesHelper.test.ts` for view title progress + pagination invariants - [x] Add a **CHANGELOG** entry under the target release for series view title progress ## Notes - Pairs with [#539](https://git.vylpes.xyz/External/card-drop/issues/539) (global % on `/series list` title); no hard dependency — can ship independently. - Per-series `(owned/total)` on list lines shipped in 0.10.0; this story adds **percentage in the view title** only.
Vylpes added this to the 0.11.0 milestone 2026-09-25 12:51:07 +01:00
Smithy-bot canceled time tracking 2026-11-01 11:03:17 +00:00
Member

Completed needs/criteria: acceptance criteria, subtasks, and scope are on the issue body (per-series completion % in /series view title; aligns with list inventory rules and #539 title pattern).

→ needs/estimate (Smithy-bot still assigned).

Completed **needs/criteria**: acceptance criteria, subtasks, and scope are on the issue body (per-series completion % in `/series view` title; aligns with list inventory rules and [#539](https://git.vylpes.xyz/External/card-drop/issues/539) title pattern). → **needs/estimate** (Smithy-bot still assigned).
Smithy-bot added spent time 2026-11-01 11:03:33 +00:00
2 minutes
Smithy-bot added spent time 2026-11-03 11:04:18 +00:00
2 minutes
Member

Story point estimate

3 story points

Rationale

  • Acceptance criteria and subtasks are concrete: load inventory in GenerateSeriesViewPage, title format {series.name} — {n}% complete, unit tests, CHANGELOG.
  • Scope is a sibling to #539 (3 pts): localized SeriesHelper + tests, no new commands or API surface.
  • Per-series owned/total rules match existing list-line logic; pagination invariant and total = 0 are specified; no open product questions.

Smithy-bot → needs/tests (next: QA scripts against the criteria).

## Story point estimate **3** story points ### Rationale - Acceptance criteria and subtasks are concrete: load inventory in `GenerateSeriesViewPage`, title format `{series.name} — {n}% complete`, unit tests, CHANGELOG. - Scope is a sibling to [#539](https://git.vylpes.xyz/External/card-drop/issues/539) (3 pts): localized `SeriesHelper` + tests, no new commands or API surface. - Per-series owned/total rules match existing list-line logic; pagination invariant and `total = 0` are specified; no open product questions. Smithy-bot → **needs/tests** (next: QA scripts against the criteria).
Member

Planning — needs/tests → needs/approval

QA scripts mapped to the acceptance criteria in the issue description. Run on a branch with the implementation merged or deployed to stage; unit-test rows via yarn test locally/CI.

Preconditions

  • Discord test user with inventory scenarios: no claims in a target series, partial completion, and 100% of that series.
  • Catalog with at least one series that has enough cards that /series view spans ≥ 2 pages (Previous/Next visible).
  • Ability to run yarn test (tests/helpers/SeriesHelper.test.ts).
  • For one series, note the (owned/total) on the matching /series list line to cross-check view title math.

AC1 — Per-series completion % in /series view embed title

ID Steps Expected
T1.1 Run /series view for a series with partial inventory Embed title includes that series’ completion percentage, not only the bare series name
T1.2 Open /series view for a series with no owned cards in that series Title shows 0% (or equivalent) for that series
T1.3 Open /series view for a fully completed series Title shows 100%

AC2 — Owned/total semantics match /series list line for that series

ID Steps Expected
T2.1 For the same user and series, read (owned/total) on /series list Baseline recorded
T2.2 Open /series view for that series Owned = inventory rows whose CardNumber appears in that series’ cards list; duplicate copies of the same card count once
T2.3 Compare view title % to list line counts Total = series.cards.length; rounded percent matches Math.round(100 * owned / total) from T2.1/T2.2
T2.4 User owns multiple copies of one card in the series Counted once toward owned (same as list line)

AC3 — Percent display and total = 0 edge case

ID Steps Expected
T3.1 Partial completion where raw ratio is not an integer Title percent is a whole number 0–100 via rounding (Math.round)
T3.2 If test harness can simulate a series with total = 0 cards (fixture/mocks) Title shows 0% without division-by-zero

AC4 — Title copy pattern

ID Steps Expected
T4.1 View embed title on /series view Follows agreed pattern, e.g. {series.name} — 67% complete (aligned with #539 list title style)
T4.2 Spot-check with empty, partial, and full series Consistent formatting; readable within Discord embed limits

AC5 — Pagination invariants (same series)

ID Steps Expected
T5.1 On page 1 of /series view, note title (series name + %) and footer/page text Baseline recorded
T5.2 Click Next to a later card page Card grid image/description and page footer change
T5.3 Compare title (name + %) on page 2 vs page 1 Identical on every page within the series
T5.4 Click Previous back to page 1 Title progress still matches T5.1

AC6 — Automated tests (GenerateSeriesViewPage / CI)

ID Steps Expected
U1 yarn test — tests/helpers/SeriesHelper.test.ts (and full suite) Green
U2 Test: no claims in series 0% in view title; safe totals
U3 Test: partial series completion Correct owned/total and rounded % in title
U4 Test: full series 100% in title
U5 Test: pagination within same series Title progress unchanged when page index changes
U6 Forgejo Actions / CI on PR Test job passes

Subtasks / scope regression

ID Steps Expected
S1 CHANGELOG entry under target release Documents series view title progress
R1 Global catalog % on /series list (#539) Out of scope for this story — no requirement to change list behaviour here
R2 Per-series (owned/total) on list lines Unchanged (0.10.0 behaviour)
R3 Web/management UI Out of scope — unchanged

Sign-off checklist

  • T1–T5, U1–U6, S1, and R1–R3 pass.
  • View title % stable across pagination; list line counts unchanged.

Moving to needs/approval for your review before implementation. @Vylpes

## Planning — needs/tests → needs/approval QA scripts mapped to the acceptance criteria in the issue description. Run on a branch with the implementation merged or deployed to **stage**; unit-test rows via `yarn test` locally/CI. ### Preconditions - Discord test user with inventory scenarios: **no claims** in a target series, **partial** completion, and **100%** of that series. - Catalog with at least one series that has **enough cards** that `/series view` spans **≥ 2 pages** (Previous/Next visible). - Ability to run `yarn test` (`tests/helpers/SeriesHelper.test.ts`). - For one series, note the `(owned/total)` on the matching `/series list` line to cross-check view title math. --- ### AC1 — Per-series completion % in `/series view` embed title | ID | Steps | Expected | |----|--------|----------| | T1.1 | Run `/series view` for a series with **partial** inventory | Embed **title** includes that series’ completion **percentage**, not only the bare series name | | T1.2 | Open `/series view` for a series with **no** owned cards in that series | Title shows **0%** (or equivalent) for that series | | T1.3 | Open `/series view` for a **fully** completed series | Title shows **100%** | --- ### AC2 — Owned/total semantics match `/series list` line for that series | ID | Steps | Expected | |----|--------|----------| | T2.1 | For the same user and series, read `(owned/total)` on `/series list` | Baseline recorded | | T2.2 | Open `/series view` for that series | **Owned** = inventory rows whose `CardNumber` appears in that series’ `cards` list; **duplicate copies of the same card count once** | | T2.3 | Compare view title % to list line counts | **Total** = `series.cards.length`; rounded percent matches `Math.round(100 * owned / total)` from T2.1/T2.2 | | T2.4 | User owns **multiple copies** of one card in the series | Counted **once** toward owned (same as list line) | --- ### AC3 — Percent display and `total = 0` edge case | ID | Steps | Expected | |----|--------|----------| | T3.1 | Partial completion where raw ratio is not an integer | Title percent is a **whole number 0–100** via **rounding** (`Math.round`) | | T3.2 | If test harness can simulate a series with **total = 0** cards (fixture/mocks) | Title shows **0%** without division-by-zero | --- ### AC4 — Title copy pattern | ID | Steps | Expected | |----|--------|----------| | T4.1 | View embed **title** on `/series view` | Follows agreed pattern, e.g. `{series.name} — 67% complete` (aligned with [#539](https://git.vylpes.xyz/External/card-drop/issues/539) list title style) | | T4.2 | Spot-check with empty, partial, and full series | Consistent formatting; readable within Discord embed limits | --- ### AC5 — Pagination invariants (same series) | ID | Steps | Expected | |----|--------|----------| | T5.1 | On page 1 of `/series view`, note **title** (series name + %) and footer/page text | Baseline recorded | | T5.2 | Click **Next** to a later card page | Card grid image/description and page footer change | | T5.3 | Compare **title** (name + %) on page 2 vs page 1 | **Identical** on every page within the series | | T5.4 | Click **Previous** back to page 1 | Title progress still matches T5.1 | --- ### AC6 — Automated tests (`GenerateSeriesViewPage` / CI) | ID | Steps | Expected | |----|--------|----------| | U1 | `yarn test` — `tests/helpers/SeriesHelper.test.ts` (and full suite) | Green | | U2 | Test: no claims in series | **0%** in view title; safe totals | | U3 | Test: partial series completion | Correct owned/total and rounded % in title | | U4 | Test: full series | **100%** in title | | U5 | Test: pagination within same series | Title progress **unchanged** when page index changes | | U6 | Forgejo Actions / CI on PR | Test job passes | --- ### Subtasks / scope regression | ID | Steps | Expected | |----|--------|----------| | S1 | **CHANGELOG** entry under target release | Documents series view title progress | | R1 | Global catalog % on `/series list` ([#539](https://git.vylpes.xyz/External/card-drop/issues/539)) | **Out of scope** for this story — no requirement to change list behaviour here | | R2 | Per-series `(owned/total)` on **list lines** | **Unchanged** (0.10.0 behaviour) | | R3 | Web/management UI | **Out of scope** — unchanged | --- ### Sign-off checklist - [ ] T1–T5, U1–U6, S1, and R1–R3 pass. - [ ] View title % stable across pagination; list line counts unchanged. Moving to **needs/approval** for your review before implementation. @Vylpes
Smithy-bot stopped working 2026-11-04 11:01:09 +00:00
16 seconds
Smithy-bot removed their assignment 2026-11-04 11:01:09 +00:00
Vylpes removed their assignment 2026-11-04 11:20:13 +00:00
Smithy-bot removed their assignment 2026-11-13 11:08:27 +00:00
Member

Implemented /series view title completion percentage.

PR: #572 (cursor/540-series-view-completion → release/0.11.0)

What changed

  • GenerateSeriesViewPage loads inventory and sets title to {series.name} — {n}% complete
  • Owned/total matches list-line semantics (unique claimed card ids in the series; Quantity > 0)
  • Shared helpers ClaimedCardIdsFromInventory / SeriesCompletionPercent (usable by #539 later)
  • Tests extended for 0% / partial / 100% / qty-zero / pagination title invariant
  • CHANGELOG Unreleased entry

Verify locally: npx tsc --noEmit, eslint on touched files, npx jest tests/helpers/SeriesHelper.test.ts (21 passed)

Moved to step/review and assigned to @Vylpes for approval. Not merging; please review PR 572.

Implemented `/series view` title completion percentage. **PR:** https://git.vylpes.xyz/External/card-drop/pulls/572 (`cursor/540-series-view-completion` → `release/0.11.0`) **What changed** - `GenerateSeriesViewPage` loads inventory and sets title to `{series.name} — {n}% complete` - Owned/total matches list-line semantics (unique claimed card ids in the series; `Quantity > 0`) - Shared helpers `ClaimedCardIdsFromInventory` / `SeriesCompletionPercent` (usable by #539 later) - Tests extended for 0% / partial / 100% / qty-zero / pagination title invariant - CHANGELOG Unreleased entry **Verify locally:** `npx tsc --noEmit`, eslint on touched files, `npx jest tests/helpers/SeriesHelper.test.ts` (21 passed) Moved to `step/review` and assigned to @Vylpes for approval. Not merging; please review PR 572.
Smithy-bot stopped working 2026-11-13 11:08:33 +00:00
2 minutes 56 seconds
Vylpes removed their assignment 2026-11-13 11:52:02 +00:00
Author
Owner

@Smithy-bot Made a comment on the PR, please fix this.

@Smithy-bot Made a comment on the PR, please fix this.
Smithy-bot removed their assignment 2026-11-14 11:09:24 +00:00
Member

Addressed the PR review feedback on #572: series view title now uses the middle-dot separator for consistency with footers elsewhere ({series.name} · {n}% complete).

Updated SeriesHelper.ts, tests, and CHANGELOG. Local verify: npx tsc --noEmit, eslint on touched files, npx jest tests/helpers/SeriesHelper.test.ts (21 passed).

Moved back to step/review and assigned to @Vylpes. Please re-review PR 572.

Addressed the PR review feedback on #572: series view title now uses the middle-dot separator for consistency with footers elsewhere (`{series.name} · {n}% complete`). Updated `SeriesHelper.ts`, tests, and CHANGELOG. Local verify: `npx tsc --noEmit`, eslint on touched files, `npx jest tests/helpers/SeriesHelper.test.ts` (21 passed). Moved back to `step/review` and assigned to @Vylpes. Please re-review PR 572.
Smithy-bot stopped working 2026-11-14 11:09:41 +00:00
4 minutes 26 seconds
Vylpes removed their assignment 2026-11-14 12:16:04 +00:00
Member

QA results — step/testing → step/uat

Branch / commit: release/0.11.0 @ 5141416 (PR #572 merge)

Pipeline

Check Result
yarn build (tsc) PASS
yarn lint (eslint .) PASS
yarn test PASS — 29 suites / 148 passed / 30 todo / 9 snapshots
tests/helpers/SeriesHelper.test.ts PASS — 21/21

Acceptance criteria (vs QA scripts T1–T5 / U1–U6 / S1)

ID Result Notes
T1 / U2–U4 PASS View title includes % complete for 0% / partial (50%) / 100%
T2 PASS ClaimedCardIdsFromInventory + SeriesCompletionPercent match list-line owned/total (unique cards, Quantity > 0)
T3 PASS Math.round(100 * owned / total); empty series → 0% (unit-tested)
T4 PASS Title pattern {name} · {n}% complete (middle-dot per review; approved in PR 572)
T5 / U5 PASS Pagination keeps title progress identical across pages
U1 / U6 PASS Full suite green on merge tip
S1 PASS CHANGELOG Unreleased entry for #540
R1–R3 PASS No global list-% (#539), list-line format, or web UI changes

Live Discord smoke (/series view + Previous/Next) left for human UAT.

Moved to step/uat and assigned @Vylpes.

## QA results — `step/testing` → `step/uat` **Branch / commit:** `release/0.11.0` @ `5141416` (PR [#572](https://git.vylpes.xyz/External/card-drop/pulls/572) merge) ### Pipeline | Check | Result | |-------|--------| | `yarn build` (`tsc`) | PASS | | `yarn lint` (`eslint .`) | PASS | | `yarn test` | PASS — **29** suites / **148** passed / **30** todo / **9** snapshots | | `tests/helpers/SeriesHelper.test.ts` | PASS — **21**/21 | ### Acceptance criteria (vs QA scripts T1–T5 / U1–U6 / S1) | ID | Result | Notes | |----|--------|-------| | T1 / U2–U4 | PASS | View title includes `% complete` for 0% / partial (50%) / 100% | | T2 | PASS | `ClaimedCardIdsFromInventory` + `SeriesCompletionPercent` match list-line owned/total (unique cards, `Quantity > 0`) | | T3 | PASS | `Math.round(100 * owned / total)`; empty series → **0%** (unit-tested) | | T4 | PASS | Title pattern `{name} · {n}% complete` (middle-dot per review; approved in PR 572) | | T5 / U5 | PASS | Pagination keeps title progress identical across pages | | U1 / U6 | PASS | Full suite green on merge tip | | S1 | PASS | CHANGELOG Unreleased entry for #540 | | R1–R3 | PASS | No global list-% (#539), list-line format, or web UI changes | Live Discord smoke (`/series view` + Previous/Next) left for human UAT. Moved to `step/uat` and assigned @Vylpes.
Smithy-bot stopped working 2026-11-16 11:02:25 +00:00
58 seconds
Smithy-bot removed their assignment 2026-11-16 11:02:27 +00:00
Smithy-bot added spent time 2026-11-16 11:02:34 +00:00
3 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 15 minutes 36 seconds
Smithy-bot
15 minutes 36 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
External/card-drop#540
No description provided.