Skip to content
Extraits de code Groupes Projets
Valider b36d6d5c rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Do not invalidate unnecessary periods.

parent f34f4ce4
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -380,16 +380,17 @@ abstract class Period ...@@ -380,16 +380,17 @@ abstract class Period
* will cascade to week and day periods and year periods will cascade to month, week and day * will cascade to week and day periods and year periods will cascade to month, week and day
* periods. * periods.
* *
* The method will return periods that are outside the range of this period * The method will not return periods that are outside the range of this period.
* and a child period for the start/end date encompasses dates outside the range. For example,
* cascading on a month will return the week period for the 1st of the month. The week period
* might include days before the 1st. When cascading further, those days will be included in
* the result.
* *
* @return Period[] * @return Period[]
* @ignore * @ignore
*/ */
public function getAllOverlappingChildPeriods() public function getAllOverlappingChildPeriods()
{
return $this->getAllOverlappingChildPeriodsInRange($this->getDateStart(), $this->getDateEnd());
}
private function getAllOverlappingChildPeriodsInRange(Date $dateStart, Date $dateEnd)
{ {
$result = array(); $result = array();
...@@ -398,8 +399,8 @@ abstract class Period ...@@ -398,8 +399,8 @@ abstract class Period
return $result; return $result;
} }
$childPeriods = Factory::build($childPeriodType, $this->getRangeString()); $childPeriods = Factory::build($childPeriodType, $dateStart->toString() . ',' . $dateEnd->toString());
return array_merge($childPeriods->getSubperiods(), $childPeriods->getAllOverlappingChildPeriods()); return array_merge($childPeriods->getSubperiods(), $childPeriods->getAllOverlappingChildPeriodsInRange($dateStart, $dateEnd));
} }
/** /**
......
...@@ -346,9 +346,6 @@ class ArchiveInvalidatorTest extends IntegrationTestCase ...@@ -346,9 +346,6 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
true, true,
array( array(
'2014_12' => array( '2014_12' => array(
'1.2014-12-29.2014-12-29.1.done',
'1.2014-12-30.2014-12-30.1.done',
'1.2014-12-31.2014-12-31.1.done',
'1.2014-12-29.2015-01-04.2.done', '1.2014-12-29.2015-01-04.2.done',
), ),
'2015_01' => array( '2015_01' => array(
...@@ -389,9 +386,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase ...@@ -389,9 +386,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
'1.2015-01-26.2015-02-01.2.done', '1.2015-01-26.2015-02-01.2.done',
'1.2015-01-01.2015-01-31.3.done', '1.2015-01-01.2015-01-31.3.done',
), ),
'2015_02' => array( '2015_02' => array(),
'1.2015-02-01.2015-02-01.1.done',
),
'2015_03' => array(), '2015_03' => array(),
'2015_04' => array(), '2015_04' => array(),
'2015_05' => array(), '2015_05' => array(),
......
...@@ -203,7 +203,6 @@ class PeriodTest extends \PHPUnit_Framework_TestCase ...@@ -203,7 +203,6 @@ class PeriodTest extends \PHPUnit_Framework_TestCase
array('week', '2015-09-14,2015-09-20'), array('week', '2015-09-14,2015-09-20'),
array('week', '2015-09-21,2015-09-27'), array('week', '2015-09-21,2015-09-27'),
array('week', '2015-09-28,2015-10-04'), array('week', '2015-09-28,2015-10-04'),
array('day', '2015-08-31,2015-08-31'),
array('day', '2015-09-01,2015-09-01'), array('day', '2015-09-01,2015-09-01'),
array('day', '2015-09-02,2015-09-02'), array('day', '2015-09-02,2015-09-02'),
array('day', '2015-09-03,2015-09-03'), array('day', '2015-09-03,2015-09-03'),
...@@ -234,10 +233,6 @@ class PeriodTest extends \PHPUnit_Framework_TestCase ...@@ -234,10 +233,6 @@ class PeriodTest extends \PHPUnit_Framework_TestCase
array('day', '2015-09-28,2015-09-28'), array('day', '2015-09-28,2015-09-28'),
array('day', '2015-09-29,2015-09-29'), array('day', '2015-09-29,2015-09-29'),
array('day', '2015-09-30,2015-09-30'), array('day', '2015-09-30,2015-09-30'),
array('day', '2015-10-01,2015-10-01'),
array('day', '2015-10-02,2015-10-02'),
array('day', '2015-10-03,2015-10-03'),
array('day', '2015-10-04,2015-10-04'),
), ),
), ),
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter