Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates no data received message #75

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,24 @@ export const App = () => {
const maxDate = endDate || new Date(Date.now());
guaranteeGlobal(globalMinDate, Number(minDate)/1000);
guaranteeGlobal(globalMaxDate, Number(maxDate)/1000);
}, [endDate, startDate, weatherStations]);
if (weatherStation && (!startDate || !endDate)) {
setStatus({
status: "error",
message: "Select a date range",
icon: <WarningIcon/>
});
}
// if the start date of the weather station is after the user's requested end date, then the station is inactive
const stationMinDate = new Date(weatherStation?.mindate || globalMinDate);
const stationNotActiveYet = stationMinDate > maxDate;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note on date range checks:
We currently only check if the station's start date is after the user's end date. We don't check the opposite (station's end date before user's start date) because our source data's end dates are not up-to-date (see note in PT-187533021) Implementing the opposite check could therefore result in false negatives for active stations.

if (stationNotActiveYet) {
setStatus({
status: "station-error",
message: "Station was inactive for date range",
icon: <WarningIcon/>
});
}
}, [endDate, startDate, weatherStations, weatherStation]);

const stationSelectionHandler = async(req: any) =>{
if (req.values.operation === "selectCases") {
Expand Down Expand Up @@ -237,7 +254,7 @@ export const App = () => {
setIsFetching(false);
setStatus({
status: "error",
message: "No data retrieved",
message: "No data retrieved. Change frequency or station.",
icon: <WarningIcon/>
});
}
Expand Down
Loading