Printing tracking for owned copies and deck art, and an outdated-card-data notice

Owned copies can now be pinned to a printing + finish (nonfoil / foil /
etched), activating the long-dormant library_card_copies table as groups
of identical copies. library_cards.quantity_owned stays authoritative:
groups are a subset of it, and the rest are "unspecified". Tracking more
copies than are unspecified grows ownership to fit; lowering ownership
trims the most recently added groups first. Migration 0006 adds the
group quantity, a unique (card, printing, finish) index, and
deck_cards.preferred_scryfall_id.

A deck slot can show a chosen printing's art, both faces from that
printing, falling back to the default when the id no longer resolves.
It survives quantity/board changes and is kept by duplicate_deck.

UI: the click preview's info tile gets a Printings section when opened
from the Library or a deck (copy groups with steppers, "Add a
printing…", and "Shown in this deck" with Change…/Default), backed by a
printing picker grid. The picker takes Escape in the capture phase so
it closes without closing the preview under it.

Sync: CardEntry.printings (keyed "<scryfall_id>/<finish>") and
DeckCardEntry.printing. Cards now merge field by field with groups per
key, so a quantity edit and a printing added on another device both
survive; merged groups are clamped deterministically. A document is
written as version 2 only once it holds printing data, so older builds
and servers refuse it instead of dropping the data and syncing the loss.

Decklists: "(SET) NUM", optionally "*F*"/"*E*", round-trips through deck
and library export/import. Library export writes a line per group plus
one for unspecified copies.

reference.db printings gain lang and released_at for picker labels and
ordering. When the installed card data lacks any column this build's
reference schema has (found by diffing against the schema applied
in-memory, so no list to maintain), a notice under the top bar offers
Update card data (and Import card data… on phones); "Not now" is
remembered until something more goes missing.
This commit is contained in:
2026-10-16 21:06:17 -05:00
parent 1c5e045591
commit 214a535588
23 changed files with 2092 additions and 138 deletions

View File

@@ -205,6 +205,39 @@ Marvel Commander — isn't hidden.
> once to enable them; until then they're inert rather than broken. Price,
> format legality and *can be a commander* work immediately.
### Printings
The library counts cards, not printings, but you can say which printing a copy
is when it matters. Click a card's image in the **Library** or a deck to open
its preview. The **Owned** section lists your copies by printing and finish
(nonfoil / foil / etched), with a stepper for each, and **Add a printing…**
picks another. Copies you haven't assigned a printing to stay *unspecified*:
"5 copies · 3 by printing · 2 unspecified". Assigning more copies to printings
than you own raises the owned count to match. Lowering the owned count drops
the most recently added printing entries first.
In a deck, **Shown in this deck → Change…** picks which printing's art that
slot shows, and **Default** goes back to the usual one. This is display only:
it doesn't need to be a copy you own.
Decklist export writes a chosen or tracked printing the way Moxfield and Arena
do, and import reads it back:
```text
1 Sol Ring (2X2) 315 *F*
4 Lightning Bolt (2XM) 129
```
`*F*` marks foil and `*E*` etched. A library export writes one line per
printing, then a plain line for the unspecified copies. A suffix that doesn't
match any printing still imports the card itself.
> The picker's dates and languages need card data from this version. Until you
> update it, printings are listed without them. Whenever your card data is
> missing something the app could use, a notice under the top bar offers
> **Update card data**, and **Import card data…** too on a phone. Dismissing it
> with **Not now** lasts until a later version needs something more.
## Sync
Your library always lives on the device you're using, so the app works the
@@ -235,6 +268,13 @@ either is lost) or **use the server's library** instead of this device's.
The Info tab also lists the account's signed-in devices, so a lost phone can be
signed out from another one.
> **Printings and older versions.** A library with printings in it (see
> [Printings](#printings)) is saved in a newer format. A device or server
> running an older version refuses it and says to update, rather than syncing
> and quietly losing them. Libraries that don't use printings stay readable by
> older versions. Update the sync server before the first device starts using
> printings.
> **Upgrading from folder sync?** Earlier versions kept the library as a JSON
> file in a folder your sync tool watched. Your library is already on each
> device, so signing in to a server picks up from there; the first device to