From 5e119882458ffa09f0088eb6655b0daef7b172c1 Mon Sep 17 00:00:00 2001
From: Thomas Steur <tsteur@users.noreply.github.com>
Date: Mon, 18 Sep 2017 15:27:31 +1200
Subject: [PATCH] Reuse existing period archives when range date is requested
 when possible (#12004)

fixes #12003
---
 core/DataAccess/ArchiveSelector.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php
index 7be972bdb8..123b6c51ee 100644
--- a/core/DataAccess/ArchiveSelector.php
+++ b/core/DataAccess/ArchiveSelector.php
@@ -178,8 +178,7 @@ class ArchiveSelector
             $bind = array();
 
             if ($firstPeriod instanceof Range) {
-                $dateCondition = "period = ? AND date1 = ? AND date2 = ?";
-                $bind[] = $firstPeriod->getId();
+                $dateCondition = "date1 = ? AND date2 = ?";
                 $bind[] = $firstPeriod->getDateStart()->toString('Y-m-d');
                 $bind[] = $firstPeriod->getDateEnd()->toString('Y-m-d');
             } else {
-- 
GitLab