diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 902fe4c38..d0fdd0a02 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -76,7 +76,7 @@ class MapAndSubscribeUserCalendarCommand extends Command 'expiration' => $expiration->format(DateTimeImmutable::ATOM), ]); - while ($offset < ($total - 1)) { + while ($offset < $total) { $users = $this->userRepository->findByMostOldSubscriptionOrWithoutSubscriptionOrData( $interval, $limit, diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 0454bae69..d14ebaa02 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -107,8 +107,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface 'users/' . $userId . '/calendarView', [ 'query' => [ - 'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), - 'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), + 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), + 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), '$count' => 'true', '$top' => 0, ], @@ -181,8 +181,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface 'users/' . $userId . '/calendarView', [ 'query' => [ - 'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), - 'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), + 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), + 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), '$select' => 'id,subject,start,end,isAllDay', '$top' => $limit, '$skip' => $offset, @@ -539,10 +539,13 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface $userId = $this->mapCalendarToUser->getUserId($user); if (null === $userId) { - throw new Exception('no remote calendar for this user', [ - 'user' => $user->getId(), - 'remoteId' => $remoteId, - ]); + throw new Exception( + sprintf( + 'no remote calendar for this user: %s, remoteid: %s', + $user->getId(), + $remoteId + ) + ); } try {