Skip to content

Commit dcce8ac

Browse files
committed
chore: adapt NASA custom area chart to use current time index if limited
1 parent 79a3e6c commit dcce8ac

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/src/components/map/Map.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,12 @@ export default {
990990
return;
991991
}
992992
window.dispatchEvent(new CustomEvent('set-custom-area-indicator-loading', { detail: true }));
993-
993+
const options = {
994+
currentTimeIndex: this.currentTimeIndex,
995+
};
994996
try {
995997
const custom = await fetchCustomAreaObjects(
996-
{},
998+
options,
997999
this.drawnArea.area,
9981000
this.mergedConfigsData[0],
9991001
this.indicator,

app/src/helpers/customAreaObjects.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ export const fetchCustomAreaObjects = async (
390390
// TODO: Sending more requests overloads server, need to think how to handle this
391391
let requestTimes = indicator.time;
392392
if (indicator.time.length > 365) {
393-
requestTimes = indicator.time.slice(-365);
393+
if (options.currentTimeIndex) {
394+
const startIndex = Math.max(0, options.currentTimeIndex - 365);
395+
requestTimes = indicator.time.slice(startIndex, options.currentTimeIndex);
396+
}
394397
}
395398
requestTimes.forEach((entry) => {
396399
const requestUrl = `${url}?url=${entry[1]}`;

0 commit comments

Comments
 (0)