From 2d2f3ca19cf86c9ff1cacda01bcbefd360c7e893 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Tue, 25 Aug 2026 13:01:35 +0200 Subject: [PATCH] Fix overdue detection: stop discarding enriched cards for CardDetails wrappers getActiveCardsInStack() reassigned $cards to CardService::enrichCards()'s return value. That return value is an array of CardDetails wrappers whose own entity fields (duedate, stackId, ...) are never populated from the wrapped card - only its overridden jsonSerialize() reads through to them. So every card's getDuedate()/getDaysUntilDue() resolved to null, and WorkflowRunner::isOverdue() was always false: no workflow could ever match a card, regardless of its actual due date. enrichCards() already mutates the original $cards entries in place (labels, assigned users, comment counts, ...), so the fix is to keep using that array instead of capturing the CardDetails return value. Bump to 0.2.3. --- appinfo/info.xml | 2 +- lib/Service/DeckIntegrationService.php | 8 +++++++- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 5a2a1dc..7a4f180 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -28,7 +28,7 @@ This app lets every user configure their own Deck automation workflows from Pers A background job periodically evaluates all enabled workflows and moves cards whose due date has passed, using Deck's own internal PHP classes only (no HTTP/OCS calls). ]]> - 0.2.2 + 0.2.3 agpl Patrick Niebeling WorkflowDeckAutomation diff --git a/lib/Service/DeckIntegrationService.php b/lib/Service/DeckIntegrationService.php index 0ada754..0e9e740 100644 --- a/lib/Service/DeckIntegrationService.php +++ b/lib/Service/DeckIntegrationService.php @@ -483,7 +483,13 @@ class DeckIntegrationService { $cardService = $this->resolve(CardService::class); $cards = $cardMapper->findAllByStack($stackId); - $cards = $cardService->enrichCards($cards); + // enrichCards() mutates each $cards entry in place (labels, assigned users, ...) but + // *returns* CardDetails wrappers whose own fields (duedate, stackId, ...) were never + // copied from the wrapped card - only its overridden jsonSerialize() reads through to + // them. Capturing that return value here made every card's getDuedate()/getDaysUntilDue() + // resolve to null, so isOverdue() was always false and no workflow ever matched a card. + // Keep using the original, now-enriched $cards instead. + $cardService->enrichCards($cards); return array_values(array_filter($cards, static function (Card $card) { if (method_exists($card, 'getDeletedAt') && (int)$card->getDeletedAt() > 0) { diff --git a/package.json b/package.json index 3856c16..0554f5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "workflow_deck_automation", - "version": "0.2.2", + "version": "0.2.3", "private": true, "type": "module", "description": "Automates moving overdue Deck cards between stacks, configurable per user.",