feat(compat): keep game aliases and library names from batch snapshots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
10c81c4390
commit
0796924f6d
@@ -30,10 +30,16 @@ def get_compat(
|
|||||||
format: str = Query("md", pattern="^(md|json)$", description="md = Markdown, json = structured"),
|
format: str = Query("md", pattern="^(md|json)$", description="md = Markdown, json = structured"),
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
) -> Response:
|
) -> Response:
|
||||||
entries = [
|
entries = []
|
||||||
Entry(game=snap.game.name if snap.game else _NO_GAME, snapshot=Surface(snap.data))
|
for snap in db.scalars(select(models.Snapshot).order_by(models.Snapshot.id)):
|
||||||
for snap in db.scalars(select(models.Snapshot).order_by(models.Snapshot.id))
|
surface = Surface(snap.data)
|
||||||
]
|
# Content-identical builds can ship with several games. Keep those aliases
|
||||||
|
# even though the legacy ORM links a snapshot to only one primary game.
|
||||||
|
games = {g for g in surface.binary.get("games", []) if isinstance(g, str) and g}
|
||||||
|
if snap.game:
|
||||||
|
games.add(snap.game.name)
|
||||||
|
for game in sorted(games or {_NO_GAME}):
|
||||||
|
entries.append(Entry(game=game, snapshot=surface))
|
||||||
table = compatibility_table(entries)
|
table = compatibility_table(entries)
|
||||||
|
|
||||||
if format == "json":
|
if format == "json":
|
||||||
|
|||||||
+1
-1
@@ -160,7 +160,7 @@ def library_name(raw: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def _library_name(snap: Snapshot) -> str:
|
def _library_name(snap: Snapshot) -> str:
|
||||||
return library_name(snap.binary.get("name") or "?")
|
return library_name(snap.binary.get("library") or snap.binary.get("name") or "?")
|
||||||
|
|
||||||
|
|
||||||
def _variant_id(index: int) -> str:
|
def _variant_id(index: int) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user