From 271f618a49421e87945c1f68b59a8775469390d5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 26 Oct 2023 19:10:03 +0200 Subject: Adding upstream version 1.43.1. Signed-off-by: Daniel Baumann --- web/api/queries/query.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/api') diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 8a4e94c9..b7e89ee9 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -1391,9 +1391,10 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before // find the first time of this tier time_t tier_first_time_s = qm->tiers[tr].db_first_time_s; + time_t tier_last_time_s = qm->tiers[tr].db_last_time_s; // can it help? - if (tier_first_time_s < selected_tier_first_time_s) { + if (tier_first_time_s < selected_tier_first_time_s && tier_first_time_s <= before_wanted && tier_last_time_s >= after_wanted) { // it can help us add detail at the beginning of the query QUERY_PLAN_ENTRY t = { .tier = tr, @@ -1423,12 +1424,13 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before continue; // find the last time of this tier + time_t tier_first_time_s = qm->tiers[tr].db_first_time_s; time_t tier_last_time_s = qm->tiers[tr].db_last_time_s; //buffer_sprintf(wb, ": EVAL BEFORE tier %d, %ld", tier, last_time_s); // can it help? - if (tier_last_time_s > selected_tier_last_time_s) { + if (tier_last_time_s > selected_tier_last_time_s && tier_first_time_s <= before_wanted && tier_last_time_s >= after_wanted) { // it can help us add detail at the end of the query QUERY_PLAN_ENTRY t = { .tier = tr, -- cgit v1.2.3