Merge branch 'calendar/fix-loading-msgraph-events' into 'master'

Fix: small fixes for remote calendars

See merge request Chill-Projet/chill-bundles!521
This commit is contained in:
Julien Fastré 2023-04-18 19:17:44 +00:00
commit 929c9f4f72
2 changed files with 12 additions and 9 deletions

View File

@ -76,7 +76,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
'expiration' => $expiration->format(DateTimeImmutable::ATOM), 'expiration' => $expiration->format(DateTimeImmutable::ATOM),
]); ]);
while ($offset < ($total - 1)) { while ($offset < $total) {
$users = $this->userRepository->findByMostOldSubscriptionOrWithoutSubscriptionOrData( $users = $this->userRepository->findByMostOldSubscriptionOrWithoutSubscriptionOrData(
$interval, $interval,
$limit, $limit,

View File

@ -107,8 +107,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
'users/' . $userId . '/calendarView', 'users/' . $userId . '/calendarView',
[ [
'query' => [ 'query' => [
'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()),
'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()),
'$count' => 'true', '$count' => 'true',
'$top' => 0, '$top' => 0,
], ],
@ -181,8 +181,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
'users/' . $userId . '/calendarView', 'users/' . $userId . '/calendarView',
[ [
'query' => [ 'query' => [
'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()),
'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()),
'$select' => 'id,subject,start,end,isAllDay', '$select' => 'id,subject,start,end,isAllDay',
'$top' => $limit, '$top' => $limit,
'$skip' => $offset, '$skip' => $offset,
@ -539,10 +539,13 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
$userId = $this->mapCalendarToUser->getUserId($user); $userId = $this->mapCalendarToUser->getUserId($user);
if (null === $userId) { if (null === $userId) {
throw new Exception('no remote calendar for this user', [ throw new Exception(
'user' => $user->getId(), sprintf(
'remoteId' => $remoteId, 'no remote calendar for this user: %s, remoteid: %s',
]); $user->getId(),
$remoteId
)
);
} }
try { try {