From 32b8ad78d5b33993665ef432fdb03d4cb6279415 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 17:49:04 +0100 Subject: [PATCH 1/7] Update index.tsx --- frontend/src/components/MapView/DateSelector/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index 3ef66dd32..ae4e3a558 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -366,6 +366,8 @@ const DateSelector = memo(() => { } const time = date.getTime(); const selectedIndex = findDateIndex(selectableDates, date.getTime()); + // eslint-disable-next-line no-console + console.log({ date, time, selectedIndex }); checkSelectedDateForLayerSupport(date.getTime()); if ( selectedIndex < 0 || @@ -396,6 +398,10 @@ const DateSelector = memo(() => { isUpdatingHistory: boolean, ) => { const selectedIndex = findDateIndex(availableDates, date); + // eslint-disable-next-line no-console + console.log('setDatePosition inc/decrement', increment); + // eslint-disable-next-line no-console + console.log({ selectedIndex }); if (availableDates[selectedIndex + increment]) { updateStartDate( new Date(availableDates[selectedIndex + increment]), From 5a005e09f03835a50e7b30939840a40da61d851c Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 20:08:19 +0100 Subject: [PATCH 2/7] Update index.tsx --- frontend/src/components/MapView/DateSelector/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index ae4e3a558..a7cc154ee 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -367,6 +367,8 @@ const DateSelector = memo(() => { const time = date.getTime(); const selectedIndex = findDateIndex(selectableDates, date.getTime()); // eslint-disable-next-line no-console + console.log(selectableDates.map(d => getFormattedDate(d, 'default'))); + // eslint-disable-next-line no-console console.log({ date, time, selectedIndex }); checkSelectedDateForLayerSupport(date.getTime()); if ( From 2d1dd80935a3f27086a1b6c6a6709f4b9e9ffa5e Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 20:44:05 +0100 Subject: [PATCH 3/7] Additional buffer fix --- .../src/components/MapView/DateSelector/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index a7cc154ee..cd08c9d75 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -181,9 +181,9 @@ const DateSelector = memo(() => { if (firstIndex === -1) { return layer.dateItems; } - // truncate the date item array at index matching timeline first date + // truncate the date item array at index matching timeline first date with a buffer of 1 day decrements // eslint-disable-next-line fp/no-mutating-methods - return layer.dateItems.slice(firstIndex); + return layer.dateItems.slice(firstIndex - 1); }), ]; }, [orderedLayers, timelineStartDate]); @@ -359,6 +359,9 @@ const DateSelector = memo(() => { ); }, [AAAvailableDates, panelTab, truncatedLayers]); + // eslint-disable-next-line no-console + console.log({ selectableDates }); + const updateStartDate = useCallback( (date: Date, isUpdatingHistory: boolean) => { if (!isUpdatingHistory) { @@ -367,7 +370,9 @@ const DateSelector = memo(() => { const time = date.getTime(); const selectedIndex = findDateIndex(selectableDates, date.getTime()); // eslint-disable-next-line no-console - console.log(selectableDates.map(d => getFormattedDate(d, 'default'))); + console.log( + selectableDates.map(d => getFormattedDate(d, DateFormat.DateTime)), + ); // eslint-disable-next-line no-console console.log({ date, time, selectedIndex }); checkSelectedDateForLayerSupport(date.getTime()); From b9522b42662a25676654ce283813b3d152f9e114 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 20:58:49 +0100 Subject: [PATCH 4/7] Use avaialable date for updateStartDate function --- .../src/components/MapView/DateSelector/index.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index cd08c9d75..442b18bc9 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -368,19 +368,14 @@ const DateSelector = memo(() => { return; } const time = date.getTime(); - const selectedIndex = findDateIndex(selectableDates, date.getTime()); + const selectedIndex = findDateIndex(availableDates, date.getTime()); // eslint-disable-next-line no-console - console.log( - selectableDates.map(d => getFormattedDate(d, DateFormat.DateTime)), - ); - // eslint-disable-next-line no-console - console.log({ date, time, selectedIndex }); checkSelectedDateForLayerSupport(date.getTime()); if ( selectedIndex < 0 || (stateStartDate && datesAreEqualWithoutTime( - selectableDates[selectedIndex], + availableDates[selectedIndex], stateStartDate, )) ) { @@ -390,7 +385,7 @@ const DateSelector = memo(() => { dispatch(updateDateRange({ startDate: time })); }, [ - selectableDates, + availableDates, checkSelectedDateForLayerSupport, stateStartDate, updateHistory, From 42510fa38f33dd657ac78f6bce75ac78686e163d Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 22:07:26 +0100 Subject: [PATCH 5/7] Fix Python version in CI --- .github/workflows/api.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 8b67ef6c0..f583da1b0 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -18,6 +18,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - name: Install Poetry uses: snok/install-poetry@v1 with: From d0fa47308bac35ae2d6da460583fc01c474c80a0 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 23:30:40 +0100 Subject: [PATCH 6/7] Update index.tsx --- frontend/src/components/MapView/DateSelector/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index 442b18bc9..e59594c56 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -359,9 +359,6 @@ const DateSelector = memo(() => { ); }, [AAAvailableDates, panelTab, truncatedLayers]); - // eslint-disable-next-line no-console - console.log({ selectableDates }); - const updateStartDate = useCallback( (date: Date, isUpdatingHistory: boolean) => { if (!isUpdatingHistory) { @@ -400,10 +397,7 @@ const DateSelector = memo(() => { isUpdatingHistory: boolean, ) => { const selectedIndex = findDateIndex(availableDates, date); - // eslint-disable-next-line no-console - console.log('setDatePosition inc/decrement', increment); - // eslint-disable-next-line no-console - console.log({ selectedIndex }); + if (availableDates[selectedIndex + increment]) { updateStartDate( new Date(availableDates[selectedIndex + increment]), From 9516eda34e0dd3efee4a1614388dcd6763a5610f Mon Sep 17 00:00:00 2001 From: ericboucher Date: Wed, 15 Jan 2025 23:31:06 +0100 Subject: [PATCH 7/7] Update index.tsx --- frontend/src/components/MapView/DateSelector/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/MapView/DateSelector/index.tsx b/frontend/src/components/MapView/DateSelector/index.tsx index e59594c56..9c520eb5b 100644 --- a/frontend/src/components/MapView/DateSelector/index.tsx +++ b/frontend/src/components/MapView/DateSelector/index.tsx @@ -366,7 +366,6 @@ const DateSelector = memo(() => { } const time = date.getTime(); const selectedIndex = findDateIndex(availableDates, date.getTime()); - // eslint-disable-next-line no-console checkSelectedDateForLayerSupport(date.getTime()); if ( selectedIndex < 0 ||