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

Bug/wf1 post error #3023

Merged
merged 19 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 4 additions & 1 deletion api/app/wildfire_one/wfwx_post_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
import logging
from typing import List
from aiohttp import ClientSession
from aiohttp import ClientSession, ClientConnectionError
from app import config
from app.schemas.morecast_v2 import WF1PostForecast

Expand All @@ -22,4 +22,7 @@

async with session.post(WF1_FORECAST_POST_URL, json=forecasts_json, headers=headers) as response:
response_json = await response.json()
if response.status >= 400:
logger.error(f'error submitting forecasts to wf1 {response_json}')
raise ClientConnectionError

Check warning on line 27 in api/app/wildfire_one/wfwx_post_api.py

View check run for this annotation

Codecov / codecov/patch

api/app/wildfire_one/wfwx_post_api.py#L25-L27

Added lines #L25 - L27 were not covered by tests
logger.info('submitted forecasts to wf1 %s.', response_json)
7 changes: 7 additions & 0 deletions web/src/features/moreCast2/components/TabbedDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
const FORECAST_ERROR_MESSAGE = 'The forecast was not saved; an unexpected error occurred.'
const FORECAST_SAVED_MESSAGE = 'Forecast was successfully saved and sent to Wildfire One.'
const FORECAST_WARN_MESSAGE = 'Forecast not submitted. A forecast can only contain N/A values for the Wind Direction.'
const WF1_ERROR_MESSAGE = 'Forecast not submitted. Wildfire One authentication error.'

interface TabbedDataGridProps {
morecast2Rows: MoreCast2Row[]
Expand Down Expand Up @@ -291,6 +292,12 @@
setSnackbarSeverity('error')
setSnackbarOpen(true)
}
} else if (isUndefined(wf1Token)) {
brettedw marked this conversation as resolved.
Show resolved Hide resolved
// Should we do something like this?
// Is it as simple as this re: wf1Token expiry? My guess is not...
setSnackbarMessage(WF1_ERROR_MESSAGE)
setSnackbarSeverity('error')
setSnackbarOpen(true)

Check warning on line 300 in web/src/features/moreCast2/components/TabbedDataGrid.tsx

View check run for this annotation

Codecov / codecov/patch

web/src/features/moreCast2/components/TabbedDataGrid.tsx#L298-L300

Added lines #L298 - L300 were not covered by tests
} else {
setSnackbarMessage(FORECAST_WARN_MESSAGE)
setSnackbarSeverity('warning')
Expand Down
Loading