Commit Graph

52 Commits

Author SHA1 Message Date
lukas 733da3419b Model refundable orders as separate purchases; add split action
Django CI/CD / test (push) Successful in 3m41s
Staging deployment / deploy (push) Successful in 1m7s
Staging deployment / comment (push) Has been skipped
Staging deployment / teardown (push) Has been skipped
Django CI/CD / build-and-push (push) Failing after 12m17s
A multi-game Purchase is now treated as an *unsplittable* bundle (one
price, whole-purchase refund). Independently-refundable multi-item orders
(e.g. a Steam cart) are instead recorded as N separate single-game
purchases, so per-game pricing and per-game refunds work with the
existing single-purchase machinery — no through-model needed.

Add-purchase form (single form, single endpoint):
- 1 game: unchanged.
- 2+ games: a "Separate price per game" toggle appears (default off =
  one bundle price). On, the bundle Price hides and one price input per
  game appears; the view creates one single-game Purchase each from
  price_for_game_<id>. `price` is now optional so combined mode still
  validates.

Split action:
- A Split button on multi-game purchase rows opens a confirmation modal
  that replaces the bundle with one single-game purchase per game (price
  split evenly, needs_price_update set), then HX-Redirects to the list.

New general-purpose `selection-fields` custom element renders one synced
form field per selected item of a source SearchSelect (consuming the
existing search-select:change contract); it knows nothing about prices,
so it is reusable. Behavior in ts/elements/selection-fields.ts.

Adds the bundle-vs-separate-purchases convention to CLAUDE.md, a split
icon, and unit + Playwright e2e coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 11:36:47 +02:00
lukas dfccfbff51 Anchor DLC purchases to a base game instead of a parent purchase
Add-on purchases (DLC, Season Pass, Battle Pass) previously linked to a
parent *purchase* via the `related_purchase` self-FK. When the base game
was bought inside a multi-game purchase (e.g. a bundle), there was no
per-game purchase to point at — only the whole bundle.

Replace it with a `related_game` FK (Game -> Game): an add-on belongs to
a *game*, which is unambiguous regardless of how the base game was bought.

- models: drop `related_purchase`; add `related_game`
  (SET_NULL, related_name="addon_purchases"); require it for non-GAME
  types in `save()`.
- forms: replace the parent-purchase picker with a flat `related_game`
  game search (reusing SearchSelectWidget/_game_options); drop the now
  unused related_purchase_queryset/RelatedPurchaseChoiceField.
- views/urls: remove the obsolete related_purchase_by_game endpoint.
- add_purchase.js: drop the parent-dropdown refetch; keep platform
  auto-fill; retarget the type toggle to #id_related_game.
- migration 0020: add -> backfill (related_game = parent's first game by
  sort_name) -> remove related_purchase.
- tests: model validation unit tests + an e2e test for the flat picker.

related_game is deliberately game->game so it can later be synced from
IGDB's parent_game without schema changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 11:36:47 +02:00
lukas ed8589a972 Fix more code smells
Django CI/CD / test (push) Successful in 39s
Django CI/CD / build-and-push (push) Successful in 1m19s
2026-06-06 13:14:55 +02:00
lukas b6864e59ce Add filters
Django CI/CD / test (push) Successful in 43s
Django CI/CD / build-and-push (push) Successful in 1m22s
2026-06-06 12:13:04 +02:00
lukas d101aecd70 Move from HTML templates to pure Python
Remove cruft
2026-06-06 07:51:10 +02:00
lukas a4e697a274 Add confirmation before deleting game
Django CI/CD / test (push) Successful in 28s
Django CI/CD / build-and-push (push) Successful in 1m1s
2026-05-12 13:37:55 +02:00
lukas 913c7d3a98 Scope URLs to the games namespace 2026-05-12 12:43:08 +02:00
lukas bc1092b0b3 Add prompt to set game to Abandoned upon refund
Django CI/CD / test (push) Successful in 36s
Django CI/CD / build-and-push (push) Successful in 1m55s
2026-02-17 22:14:36 +01:00
lukas 5cac19be7b Fix dropdown and formatting 2026-01-15 21:18:40 +01:00
lukas 23b4a7a069 Make it possible to edit and delete status changes
Django CI/CD / test (push) Successful in 1m11s
Django CI/CD / build-and-push (push) Successful in 2m18s
2025-03-22 23:45:02 +01:00
lukas 89de85c00d Introduce game status, playevents
Django CI/CD / test (push) Successful in 1m10s
Django CI/CD / build-and-push (push) Successful in 2m21s
2025-03-22 20:59:23 +01:00
lukas 6bd8271291 Remove Edition
Django CI/CD / test (push) Failing after 54s
Django CI/CD / build-and-push (push) Has been skipped
2025-01-29 22:05:06 +01:00
lukas c2853a3ecc purchases can now refer to multiple editions
Django CI/CD / test (push) Successful in 1m3s
Django CI/CD / build-and-push (push) Successful in 2m36s
allows purchases to be for more than one game
2025-01-08 21:00:19 +01:00
lukas c6b1badf39 add session search
Django CI/CD / test (push) Successful in 1m10s
Django CI/CD / build-and-push (push) Successful in 2m16s
2024-11-09 21:34:01 +00:00
lukas 7f6584ecf7 finish purchase from list 2024-09-11 11:39:54 +02:00
lukas 3063a3d143 refund purchase from list 2024-09-10 14:50:02 +02:00
lukas b589199ca6 drop purchase from list 2024-09-10 14:46:50 +02:00
lukas 2fd44c1f53 separate views out 2/2
Django CI/CD / test (push) Successful in 57s
Django CI/CD / build-and-push (push) Has been skipped
2024-08-12 21:52:26 +02:00
lukas 973f4416de separate views out 1/2 2024-08-12 21:42:34 +02:00
lukas 3099f02145 list editions 2024-08-11 20:21:27 +02:00
lukas 74b9d0421c list platforms, fix editing platform 2024-08-11 18:34:50 +02:00
lukas c61adad180 list games 2024-08-11 18:21:11 +02:00
lukas 020e12e20b remove session recent filter 2024-08-11 17:58:08 +02:00
lukas 6ef56bfed5 list, edit, and delete devices 2024-08-11 17:53:36 +02:00
lukas 453b4fd922 add manage -> sessions 2024-08-11 17:22:58 +02:00
lukas 3de40ccad3 create purchase list without paging 2024-08-08 20:17:43 +02:00
lukas d622ddfbf3 Add all-time stats 2024-08-04 22:40:37 +02:00
lukas 6328d835ee Fix formatting 2024-07-09 23:04:14 +02:00
lukas e19caf47bf Make game overview more appealing
Django CI/CD / build-and-push (push) Blocked by required conditions
Django CI/CD / test (push) Has been cancelled
2024-07-09 23:03:03 +02:00
lukas cd804f2c77 Sort url paths 2024-06-03 18:18:58 +02:00
lukas 15997bd5af Re-enable delete session delete view 2024-06-03 18:07:10 +02:00
lukas 880ea93424 Unify url path names 2024-06-03 18:05:34 +02:00
lukas 86e25b84ab Allow deleting purchases
Django CI/CD / test (push) Successful in 53s
Django CI/CD / build-and-push (push) Successful in 1m47s
2024-04-29 16:35:54 +02:00
lukas 6ba187f8e4 Make it possible to end session from game overview 2024-01-14 21:27:18 +01:00
lukas 3f037b4c7c Only allow choosing purchases of selected edition
continuous-integration/drone/push Build is passing
2023-11-15 14:25:42 +01:00
lukas 60d29090a1 Adding new games is easier 2023-11-09 21:11:28 +01:00
lukas 71b90b8202 Add stats link, year selector 2023-11-02 09:20:09 +01:00
lukas 57d4fd7212 Add yearly stats page
Fixes #15
2023-11-01 20:35:52 +01:00
lukas a5b2854bf6 Add a button to start session from game overview
continuous-integration/drone/push Build is passing
Fix #62
2023-10-13 19:22:43 +02:00
lukas e3ee832d3f Adjust game edit URL
continuous-integration/drone/push Build is passing
2023-10-01 21:28:20 +02:00
lukas 7467e2732d Add game overview page
Fixes #8
2023-10-01 21:28:02 +02:00
lukas 104ffc9d03 disable deleting sessions in code
continuous-integration/drone/push Build is passing
2023-09-17 17:17:22 +02:00
lukas 65c175afb2 Allow editing filtered entities from session list 2023-02-20 17:16:19 +01:00
lukas 938c82a395 Allow filtering by game, edition, purchase from the session list 2023-02-19 14:36:12 +01:00
lukas 51d8e953c0 Allow editing editions 2023-02-18 21:47:25 +01:00
lukas f2eb14d3ef Fix session starting 2023-02-18 21:43:51 +01:00
lukas 8a8b05b0bd Add support for device info
Closes #49
2023-02-18 21:12:18 +01:00
lukas d4ab0596da Re-introduce index view
continuous-integration/drone/push Build is passing
2023-02-18 20:50:36 +01:00
lukas 25bc74eff1 Add support for game editions (#28) 2023-02-18 20:49:46 +01:00
lukas 4892218c83 Show only last 30 days on homepage
Fixes #47
2023-01-30 22:16:28 +01:00