From 1f4b6d411534117919f8f9529faa677fcf01ec99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 14 Jun 2020 14:49:46 +0200 Subject: [PATCH] Fix VTODO and issues during rebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Db/Card.php | 12 ++++++++---- lib/Db/CardMapper.php | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/Db/Card.php b/lib/Db/Card.php index 8870202fd..0b157fd56 100644 --- a/lib/Db/Card.php +++ b/lib/Db/Card.php @@ -123,9 +123,12 @@ public function getCalendarObject(): VCalendar { $calendar = new VCalendar(); $event = $calendar->createComponent('VTODO'); $event->UID = 'deck-card-' . $this->getId(); - $event->DTSTAMP = new \DateTime($this->getDuedate()); - $event->DTSTART = new \DateTime($this->getDuedate()); - $event->DTEND = new \DateTime($this->getDuedate()); + if ($this->getDuedate()) { + $event->DTSTAMP = new \DateTime(); + $event->DTSTART = new \DateTime($this->getDuedate()); + $event->DTEND = new \DateTime($this->getDuedate()); + $event->DURATION = "PT1H"; + } $event->add('RELATED-TO', 'deck-stack-' . $this->getStackId()); // FIXME: For write support: CANCELLED / IN-PROCESS handling @@ -134,6 +137,7 @@ public function getCalendarObject(): VCalendar { $date = new DateTime(); $date->setTimestamp($this->getLastModified()); $event->COMPLETED = $date; + //$event->add('PERCENT-COMPLETE', 100); } if (count($this->getLabels()) > 0) { $event->CATEGORIES = array_map(function ($label) { @@ -142,7 +146,7 @@ public function getCalendarObject(): VCalendar { } foreach ($this->getAssignedUsers() as $user) { $participant = $user->resolveParticipant(); - // FIXME use proper uri + // FIXME use proper uri $event->add('ATTENDEE', 'https://localhost/remote.php/dav/principals/users/:' . $participant->getUID(), [ 'CN' => $participant->getDisplayName()]); } diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php index 57ab92301..d5e2fc721 100644 --- a/lib/Db/CardMapper.php +++ b/lib/Db/CardMapper.php @@ -145,7 +145,8 @@ public function findAll($stackId, $limit = null, $offset = null, $since = -1) { ->andWhere($qb->expr()->neq('archived', $qb->createNamedParameter(true))) ->andWhere($qb->expr()->eq('deleted_at', $qb->createNamedParameter(0))) ->andWhere($qb->expr()->gt('last_modified', $qb->createNamedParameter($since))) - ->orderBy('order', 'id') + ->addOrderBy('order') + ->addOrderBy('id') ->setMaxResults($limit) ->setFirstResult($offset); return $this->findEntities($qb);