Fix Ownership Type Values on Game List Edit Form #369

Closed
opened 2026-06-09 16:36:22 -05:00 by Samolexie · 1 comment
Member

Users can choose an ownership type when adding or editing a game list entry, but the edit form currently saves a shifted value compared with the ownership badge shown on the list page.

The canonical ownership values are 1 through 4: Played, but don't own, Digital Copy, Retail Version, and Collector's Edition. The create/edit form should submit those same values, validation should accept them, and the public list should display the matching badge after save.

Scope

  • Fix the game list ownership select so each visible option submits the matching canonical ownership value.
  • Ensure the blank - option remains nullable and does not trigger The selected ownership is invalid.
  • Ensure Played, but don't own can be selected and saved as ownership value 1.
  • Ensure Digital Copy, Retail Version, and Collector's Edition save as values 2, 3, and 4 respectively.
  • Ensure the edit form preselects the saved ownership value instead of the previous or shifted display value.
  • Ensure the list page continues to render ownership badges through the existing ownership label and badge presenter.
  • Do not change the canonical ownership labels, database enum values, or public badge designs as part of this issue.

Acceptance Criteria

  • Editing a list entry from blank ownership to Played, but don't own succeeds without validation errors.
  • Editing a list entry to Digital Copy stores ownership value 2 and the list page shows Digital Copy.
  • Editing a list entry to Retail Version stores ownership value 3 and the list page shows Retail Version.
  • Editing a list entry to Collector's Edition stores ownership value 4 and the list page shows Collector's Edition.
  • Editing a list entry back to the blank - ownership option stores null and the list page shows the fallback - badge.
  • Reloading the edit page preselects the saved ownership value for every supported ownership option.
  • Existing ownership badges on /list/{username} remain unchanged for values 1, 2, 3, and 4.

Test Coverage Required

  • Feature test proving the edit form renders ownership options with the canonical submitted values: blank, 1, 2, 3, and 4.
  • Feature test proving each ownership value can be saved through game-lists.update and persists to game_lists.ownership.
  • Feature test proving the public list displays the matching ownership label after an edit.
  • Regression test proving blank ownership remains valid and persists as null.
  • Keep or extend the existing list-page badge coverage for all ownership values.
  • Run the focused game list feature tests, then run vendor/bin/pint --dirty before closing the issue.

Progress Checklist

  • game_lists.ownership supports canonical values 1, 2, 3, and 4
  • GameListController centralizes ownership labels for the form and badge presenter
  • GameListController validates ownership against values 1, 2, 3, and 4
  • Public list rows and cards render ownership through the shared ownership badge partial
  • Existing Pest coverage confirms the public list renders badges for all ownership values
  • Fix the ownership select submission value mismatch on create/edit forms
  • Confirm Played, but don't own can be selected and saved
  • Confirm Digital Copy, Retail Version, and Collector's Edition save without shifting
  • Confirm the blank ownership option remains nullable and valid
  • Confirm edit pages preselect the saved ownership value
  • Add focused Pest regression coverage
  • Run affected tests and Pint
Users can choose an ownership type when adding or editing a game list entry, but the edit form currently saves a shifted value compared with the ownership badge shown on the list page. The canonical ownership values are `1` through `4`: `Played, but don't own`, `Digital Copy`, `Retail Version`, and `Collector's Edition`. The create/edit form should submit those same values, validation should accept them, and the public list should display the matching badge after save. ## Scope - Fix the game list ownership select so each visible option submits the matching canonical ownership value. - Ensure the blank `-` option remains nullable and does not trigger `The selected ownership is invalid`. - Ensure `Played, but don't own` can be selected and saved as ownership value `1`. - Ensure `Digital Copy`, `Retail Version`, and `Collector's Edition` save as values `2`, `3`, and `4` respectively. - Ensure the edit form preselects the saved ownership value instead of the previous or shifted display value. - Ensure the list page continues to render ownership badges through the existing ownership label and badge presenter. - Do not change the canonical ownership labels, database enum values, or public badge designs as part of this issue. ## Acceptance Criteria - Editing a list entry from blank ownership to `Played, but don't own` succeeds without validation errors. - Editing a list entry to `Digital Copy` stores ownership value `2` and the list page shows `Digital Copy`. - Editing a list entry to `Retail Version` stores ownership value `3` and the list page shows `Retail Version`. - Editing a list entry to `Collector's Edition` stores ownership value `4` and the list page shows `Collector's Edition`. - Editing a list entry back to the blank `-` ownership option stores `null` and the list page shows the fallback `-` badge. - Reloading the edit page preselects the saved ownership value for every supported ownership option. - Existing ownership badges on `/list/{username}` remain unchanged for values `1`, `2`, `3`, and `4`. ## Test Coverage Required - Feature test proving the edit form renders ownership options with the canonical submitted values: blank, `1`, `2`, `3`, and `4`. - Feature test proving each ownership value can be saved through `game-lists.update` and persists to `game_lists.ownership`. - Feature test proving the public list displays the matching ownership label after an edit. - Regression test proving blank ownership remains valid and persists as `null`. - Keep or extend the existing list-page badge coverage for all ownership values. - Run the focused game list feature tests, then run `vendor/bin/pint --dirty` before closing the issue. ## Progress Checklist - [x] `game_lists.ownership` supports canonical values `1`, `2`, `3`, and `4` - [x] `GameListController` centralizes ownership labels for the form and badge presenter - [x] `GameListController` validates ownership against values `1`, `2`, `3`, and `4` - [x] Public list rows and cards render ownership through the shared ownership badge partial - [x] Existing Pest coverage confirms the public list renders badges for all ownership values - [x] Fix the ownership select submission value mismatch on create/edit forms - [x] Confirm `Played, but don't own` can be selected and saved - [x] Confirm `Digital Copy`, `Retail Version`, and `Collector's Edition` save without shifting - [x] Confirm the blank ownership option remains nullable and valid - [x] Confirm edit pages preselect the saved ownership value - [x] Add focused Pest regression coverage - [x] Run affected tests and Pint
Codex changed title from Ownership type different in list than in edit mode to Fix Ownership Type Values on Game List Edit Form 2026-06-09 20:14:54 -05:00
jimmyb self-assigned this 2026-06-10 11:37:58 -05:00
Member

Implemented in 25d7e6a (Fix game list ownership select values).

Notes:

  • The ownership select was using Collection::merge() with numeric keys, which reindexed the canonical ownership values and shifted the submitted values.
  • The form now builds select options from key-preserving maps, so blank ownership plus values 1, 2, 3, and 4 render and submit as expected.
  • Added focused GameListPageTest coverage for canonical option rendering, edit-page preselection for every supported ownership value, update persistence for 1 through 4, public label rendering after edits, and blank ownership persisting as null.

Verification:

  • php artisan test --compact tests/Feature/GameListPageTest.php passed: 43 tests, 500 assertions.
  • vendor/bin/pint --dirty --format agent passed.
Implemented in `25d7e6a` (`Fix game list ownership select values`). Notes: - The ownership select was using `Collection::merge()` with numeric keys, which reindexed the canonical ownership values and shifted the submitted values. - The form now builds select options from key-preserving maps, so blank ownership plus values `1`, `2`, `3`, and `4` render and submit as expected. - Added focused `GameListPageTest` coverage for canonical option rendering, edit-page preselection for every supported ownership value, update persistence for `1` through `4`, public label rendering after edits, and blank ownership persisting as `null`. Verification: - `php artisan test --compact tests/Feature/GameListPageTest.php` passed: 43 tests, 500 assertions. - `vendor/bin/pint --dirty --format agent` passed.
Codex 2026-06-10 12:09:29 -05:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
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
MyVideoGameList/myvideogamelist.com#369
No description provided.