From 6de894487cf21ff7d795b2a9d33594fc2d08235f Mon Sep 17 00:00:00 2001 From: Caluera Date: Sun, 10 Oct 2021 14:06:31 +0200 Subject: [PATCH 1/3] added expiration date and helper to resolveTicket --- lib/Service/TicketService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Service/TicketService.php b/lib/Service/TicketService.php index 55d3787..03f5a48 100644 --- a/lib/Service/TicketService.php +++ b/lib/Service/TicketService.php @@ -79,12 +79,20 @@ class TicketService { $title = array_get($matrixTicketContent, "title", "Untitled"); $description = array_get($matrixTicketContent, "description", ""); $lastModified = $this->matrix->getLastEventDate($ticket->getMatrixRoom()); + $matrixHelperUser = $ticket->getMatrixHelperUser(); + $matrixHelperUserName = $matrixHelperUser ? "Helfer Name" : "nicht zugewiesen"; + //FIXME : set $maxHelpTime somewhere as an option or at least available for other functions + $maxHelpTime = 7 * 24 * 60 * 60 * 1000; + $expirationDate = $lastModified + $maxHelpTime; return array( 'ticketId' => $ticketId, 'status' => $ticket->getStatus(), 'lastModified' => $lastModified, 'title' => $title, 'description' => $description, + 'matrixHelperUser' => $matrixHelperUser, + 'matrixHelferName' => $matrixHelperUserName, + 'expirationDate' => $expirationDate ); } catch (MatrixException | RoomNotFoundException $e) { return array( From d7cdae5841fa30d28c35342eb0d4e7b20d4aa8e2 Mon Sep 17 00:00:00 2001 From: Caluera Date: Sun, 10 Oct 2021 14:09:16 +0200 Subject: [PATCH 2/3] delete unnecessary variable from return statement --- lib/Service/TicketService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Service/TicketService.php b/lib/Service/TicketService.php index 03f5a48..a314630 100644 --- a/lib/Service/TicketService.php +++ b/lib/Service/TicketService.php @@ -90,7 +90,6 @@ class TicketService { 'lastModified' => $lastModified, 'title' => $title, 'description' => $description, - 'matrixHelperUser' => $matrixHelperUser, 'matrixHelferName' => $matrixHelperUserName, 'expirationDate' => $expirationDate ); From ae0ffa811f99d5ee49597ff70a01aed705377b0c Mon Sep 17 00:00:00 2001 From: Caluera Date: Sun, 10 Oct 2021 14:26:31 +0200 Subject: [PATCH 3/3] get all the values from the matrix --- lib/Service/TicketService.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Service/TicketService.php b/lib/Service/TicketService.php index a314630..6f9dd20 100644 --- a/lib/Service/TicketService.php +++ b/lib/Service/TicketService.php @@ -68,6 +68,7 @@ class TicketService { } /** + * matrixTicketContent has all the syncronized data * @param MatrixTicket $ticket the database object. * @return array a JSON serializable representation of the resolved ticket, for the frontend. */ @@ -79,11 +80,8 @@ class TicketService { $title = array_get($matrixTicketContent, "title", "Untitled"); $description = array_get($matrixTicketContent, "description", ""); $lastModified = $this->matrix->getLastEventDate($ticket->getMatrixRoom()); - $matrixHelperUser = $ticket->getMatrixHelperUser(); - $matrixHelperUserName = $matrixHelperUser ? "Helfer Name" : "nicht zugewiesen"; - //FIXME : set $maxHelpTime somewhere as an option or at least available for other functions - $maxHelpTime = 7 * 24 * 60 * 60 * 1000; - $expirationDate = $lastModified + $maxHelpTime; + $matrixHelperUserName = array_get($matrixTicketContent, "matrixHelperUserName", "nicht zugewiesen"); + $expirationDate = array_get($matrixTicketContent, "expiration date", ""); return array( 'ticketId' => $ticketId, 'status' => $ticket->getStatus(),