Capture back-face printing images for double-faced cards
Add a back_image_uri column to printings, populated during ingest from a card's second card_faces image (only present for transform/MDFC/ reversible cards — split/adventure cards share one combined image and correctly get ""). Plumb it through CardRef across every query path (search, library, filters, deck contents) via the same printing row, using a shared deterministic ORDER BY so front/back always come from one printing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -82,13 +82,14 @@ impl Catalog {
|
||||
let mut stmt = self.conn.prepare(&format!(
|
||||
"SELECT dc.quantity, dc.is_commander, COALESCE(lc.quantity_owned, 0),
|
||||
oc.oracle_id, oc.name, oc.mana_value, oc.colors, oc.color_identity,
|
||||
oc.type_line, {image}
|
||||
oc.type_line, {image}, {back}
|
||||
FROM deck_cards dc
|
||||
JOIN {REF_DB}.oracle_cards oc ON oc.oracle_id = dc.oracle_id
|
||||
LEFT JOIN library_cards lc ON lc.oracle_id = dc.oracle_id
|
||||
WHERE dc.deck_id = ?1
|
||||
ORDER BY oc.name COLLATE NOCASE",
|
||||
image = crate::db::image_subquery()
|
||||
image = crate::db::image_subquery("image_uri"),
|
||||
back = crate::db::image_subquery("back_image_uri")
|
||||
))?;
|
||||
let rows = stmt
|
||||
.query_map(params![deck_id], |r| {
|
||||
@@ -104,6 +105,7 @@ impl Catalog {
|
||||
color_identity: ColorSet(r.get::<_, i64>(7)? as u8),
|
||||
type_line: r.get(8)?,
|
||||
image_uri: r.get::<_, Option<String>>(9)?.unwrap_or_default(),
|
||||
back_image_uri: r.get::<_, Option<String>>(10)?.unwrap_or_default(),
|
||||
},
|
||||
})
|
||||
})?
|
||||
|
||||
Reference in New Issue
Block a user