diff options
author | diosmosis <benaka@piwik.pro> | 2015-10-07 16:49:12 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-12 21:05:36 +0300 |
commit | b36d6d5c61dcb934e27d0b99506be739744fd1f1 (patch) | |
tree | 306b36fe942af7424a5c86c9587d9a446e27f8f4 /core | |
parent | f34f4ce4b71e4fa97cd5c1b6ce37ee6553a70cf4 (diff) |
Do not invalidate unnecessary periods.
Diffstat (limited to 'core')
-rw-r--r-- | core/Period.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Period.php b/core/Period.php index b13499b4cf..8225381ec2 100644 --- a/core/Period.php +++ b/core/Period.php @@ -380,17 +380,18 @@ abstract class Period * will cascade to week and day periods and year periods will cascade to month, week and day * periods. * - * The method will 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. + * The method will not return periods that are outside the range of this period. * * @return Period[] * @ignore */ public function getAllOverlappingChildPeriods() { + return $this->getAllOverlappingChildPeriodsInRange($this->getDateStart(), $this->getDateEnd()); + } + + private function getAllOverlappingChildPeriodsInRange(Date $dateStart, Date $dateEnd) + { $result = array(); $childPeriodType = $this->getImmediateChildPeriodLabel(); @@ -398,8 +399,8 @@ abstract class Period return $result; } - $childPeriods = Factory::build($childPeriodType, $this->getRangeString()); - return array_merge($childPeriods->getSubperiods(), $childPeriods->getAllOverlappingChildPeriods()); + $childPeriods = Factory::build($childPeriodType, $dateStart->toString() . ',' . $dateEnd->toString()); + return array_merge($childPeriods->getSubperiods(), $childPeriods->getAllOverlappingChildPeriodsInRange($dateStart, $dateEnd)); } /** |