diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-06-19 12:22:30 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-06-25 04:59:04 +0200 |
commit | cba783f5df8b0129d6b95056ef299e504fed4094 (patch) | |
tree | 0d9744ee201a041822277607181e8d81e3d04d63 /apps/dav/lib/BackgroundJob | |
parent | da533d747088633535e5d5281da433753d3cfc81 (diff) | |
download | nextcloud-server-cba783f5df8b0129d6b95056ef299e504fed4094.tar.gz nextcloud-server-cba783f5df8b0129d6b95056ef299e504fed4094.zip |
Calendar resource booking: unit tests / adding missing annotations
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/BackgroundJob')
-rw-r--r-- | apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php index 0c78f713605..a01540a6292 100644 --- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php @@ -243,7 +243,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $sorted = [ 'new' => [], 'deleted' => [], - 'existing' => [], + 'edited' => [], ]; $backendIds = array_merge(array_keys($cached), array_keys($remote)); @@ -251,11 +251,11 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { if (!isset($cached[$backendId])) { $sorted['new'][$backendId] = $remote[$backendId]; } elseif (!isset($remote[$backendId])) { - $sorted['deleted'][$backendId] = $remote[$backendId]; + $sorted['deleted'][$backendId] = $cached[$backendId]; } else { $sorted['new'][$backendId] = array_diff($remote[$backendId], $cached[$backendId]); $sorted['deleted'][$backendId] = array_diff($cached[$backendId], $remote[$backendId]); - $sorted['existing'][$backendId] = array_intersect($remote[$backendId], $cached[$backendId]); + $sorted['edited'][$backendId] = array_intersect($remote[$backendId], $cached[$backendId]); } } @@ -272,7 +272,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $query = $this->db->getQueryBuilder(); $query->insert($table) ->values([ - 'backend_id' => $query->createNamedParameter($remote->getBackend()), + 'backend_id' => $query->createNamedParameter($remote->getBackend()->getBackendIdentifier()), 'resource_id' => $query->createNamedParameter($remote->getId()), 'email' => $query->createNamedParameter($remote->getEMail()), 'displayname' => $query->createNamedParameter($remote->getDisplayName()), @@ -320,6 +320,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $this->serializeGroupRestrictions( $remote->getGroupRestrictions() ))) + ->where($query->expr()->eq('backend_id', $query->createNamedParameter($remote->getBackend()->getBackendIdentifier()))) + ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($remote->getId()))) ->execute(); } |