improve free/busy calculation performance
authorCornelius Weiß <c.weiss@metaways.de>
Fri, 13 Jan 2017 15:26:29 +0000 (16:26 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 16 Jan 2017 08:54:51 +0000 (09:54 +0100)
Change-Id: Id41c011b60340954e06038acd833cabb52e9af03
Reviewed-on: http://gerrit.tine20.com/customers/4089
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Controller/EventTests.php
tine20/Calendar/Controller/Event.php

index da1343b..63b4815 100644 (file)
@@ -568,7 +568,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $this->setExpectedException('Calendar_Exception_AttendeeBusy');
         $this->_controller->update($persitentConflictEvent, TRUE);
     }
-    
+
     public function testAttendeeAuthKeyPreserv()
     {
         $event = $this->_getEvent();
index 79137ba..af3decc 100644 (file)
@@ -329,14 +329,11 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
         $conflictFilter->addFilterGroup($periodCandidates);
         $conflictCandidates = $this->search($conflictFilter);
 
-        $from = Tinebase_DateTime::now();
-        $until = Tinebase_DateTime::now();
-
+        $from = $until = false;
         foreach ($periodCandidates as $periodFilter) {
             $period = $periodFilter->getValue();
-            $from = min($from, $period['from']);
-            $until = max($until, $period['until']);
-//            Calendar_Model_Rrule::mergeRecurrenceSet($conflictCandidates, $period['from'], $period['until']);
+            $from = $from ? min($from, $period['from']) : $period['from'];
+            $until = $until ?  max($until, $period['until']) : $period['until'];
         }
         Calendar_Model_Rrule::mergeRecurrenceSet($conflictCandidates, $from, $until);