Skip to content

Commit

Permalink
Revert "Revert "Update predtimechart.js""
Browse files Browse the repository at this point in the history
This reverts commit 1875117.
  • Loading branch information
zkamvar committed Nov 22, 2024
1 parent 43f71aa commit 873ece6
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions static/resources/predtimechart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,11 @@ function _fetchData(isForecast, targetKey, taskIDs, referenceDate) {
const taskIDsValsStr = replace_chars(taskIDsValsSorted.join(' '));

let target_path;
// Get the reference date for today and use it to find
// the correct targets file
var now = new Date();
const day = now.getDay();
var days_to_saturday = 6 - day;
if (days_to_saturday < 0) {
days_to_saturday = days_to_saturday + 7;
}
now.setDate(now.getDate() + days_to_saturday);
const tagetDate = now.toISOString().split("T")[0];

const slug = `${targetKeyStr}_${taskIDsValsStr}`;
const forecast_file_name = `${slug}_${referenceDate}.json`;
const target_file_name = `${slug}_${tagetDate}.json`;
const file_name = `${targetKeyStr}_${taskIDsValsStr}_${referenceDate}.json`;
if (isForecast) {
target_path = `${root}/forecasts/${forecast_file_name}`;
target_path = `${root}/forecasts/${file_name}`;
} else {
target_path = `${root}/targets/${target_file_name}`;
target_path = `${root}/targets/${file_name}`;
}
return fetch(target_path); // Pwomise?
}
Expand Down

0 comments on commit 873ece6

Please sign in to comment.