From 6438f8e880df5b04ff974179897ae507bb30285c Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Tue, 3 Jan 2023 21:31:02 +1100
Subject: Query server when zoomed in enough even if within an already queried
 range

For server query parameter range=date1.date2, exclude date2
Fix unnecessary calendar-to-year date conversion when building sql query
For frontend DateRangeTree class, rename has() to contains()
---
 src/components/TimeLine.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/components/TimeLine.vue')

diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index 6595bed..76d78d0 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -407,7 +407,7 @@ const endIsLastVisible = computed(() => {
 function dateToOffset(date: HistDate){ // Assumes 'date' is >=firstDate and <=lastDate
 	// Find containing major tick
 	let tickIdx = firstIdx.value;
-	for (let i = tickIdx + 1; i <= lastIdx.value; i++){
+	for (let i = tickIdx + 1; i < lastIdx.value; i++){
 		if (ticks.value[i].major){
 			if (!date.isEarlier(ticks.value[i].date)){
 				tickIdx = i;
@@ -436,7 +436,7 @@ const idToEvent = computed(() => { // Maps visible event IDs to HistEvents
 	while (itr.data() != null){
 		let event = itr.data()!;
 		itr.next();
-		if (lastDate.value.isEarlier(event.start)){
+		if (!event.start.isEarlier(lastDate.value)){
 			break;
 		}
 		map.set(event.id, event);
-- 
cgit v1.2.3

