summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/BackgroundJob
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-06-19 12:22:30 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-06-25 04:59:04 +0200
commitcba783f5df8b0129d6b95056ef299e504fed4094 (patch)
tree0d9744ee201a041822277607181e8d81e3d04d63 /apps/dav/lib/BackgroundJob
parentda533d747088633535e5d5281da433753d3cfc81 (diff)
downloadnextcloud-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.php10
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();
}