update
This commit is contained in:
@@ -103,6 +103,21 @@ def make_spawner(topic: str, files: dict):
|
||||
return spawn
|
||||
|
||||
|
||||
async def seed_artefact_cards(topic: str, files: dict) -> int:
|
||||
"""Board-2-only (Inventar läuft NICHT mit): für jeden fertigen Block eine ablock-Karte
|
||||
erzeugen, falls noch keine existiert — sonst liefe ohne den Board-1-Spawn-Hook nichts
|
||||
durch Board 2. Vorhandene Karten bleiben (sie resümieren in ihrer Spalte). → neue Karten."""
|
||||
spawn = make_spawner(topic, files)
|
||||
existing = {c["card_id"] for c in await db.kanban_cards(topic, board=BOARD, kind="ablock")}
|
||||
n = 0
|
||||
for c in await db.kanban_cards(topic, board="inventory", kind="block", stage="done_block"):
|
||||
norm = c["payload"].get("mirrored_norm")
|
||||
if norm and norm not in existing:
|
||||
await spawn(c["card_id"], c["payload"])
|
||||
n += 1
|
||||
return n
|
||||
|
||||
|
||||
async def _gather_cards(ctx: GenContext, flow: Flow, cards, one):
|
||||
results = await asyncio.gather(*[one(c) for c in cards], return_exceptions=True)
|
||||
errs = [r for r in results if isinstance(r, Exception)]
|
||||
|
||||
Reference in New Issue
Block a user