Fix overdue detection: stop discarding enriched cards for CardDetails wrappers
Build package / php-lint (8.2) (push) Successful in 45s
Build package / php-lint (8.3) (push) Successful in 39s
Build package / php-lint (8.4) (push) Successful in 42s
Build package / php-lint (8.5) (push) Successful in 39s
Build package / xml-lint (push) Successful in 12s
Build package / unit-tests (push) Successful in 44s
Build package / package (push) Successful in 1m1s
Build package / php-lint (8.2) (push) Successful in 45s
Build package / php-lint (8.3) (push) Successful in 39s
Build package / php-lint (8.4) (push) Successful in 42s
Build package / php-lint (8.5) (push) Successful in 39s
Build package / xml-lint (push) Successful in 12s
Build package / unit-tests (push) Successful in 44s
Build package / package (push) Successful in 1m1s
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.
This commit is contained in:
+1
-1
@@ -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).
|
||||
]]></description>
|
||||
<version>0.2.2</version>
|
||||
<version>0.2.3</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="patrick@niebel.ing">Patrick Niebeling</author>
|
||||
<namespace>WorkflowDeckAutomation</namespace>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user