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

MoreCast 2.0 - Simulated Indices #3200

Merged
merged 48 commits into from
Nov 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a37074f
adds more fwi functions from R library
brettedw Oct 17, 2023
d6faa20
adds lat/long to WeatherIndeterminate
brettedw Oct 17, 2023
95af97e
calculate forecasted fwi system values
brettedw Oct 17, 2023
ba327f0
adds FWI actuals/forecasts to Forecast Summary tab
brettedw Oct 19, 2023
e17027e
Morecast 2.0 frontend
brettedw Oct 25, 2023
784ab60
Morecast 2.0 backend
brettedw Oct 25, 2023
a4bd266
updates api and updates forecasts in redux store
brettedw Oct 26, 2023
264b8ff
updates tests
brettedw Oct 26, 2023
9b58a8f
docstring
brettedw Oct 26, 2023
233e84a
Merge branch 'main' into task/simulated-indices
brettedw Oct 26, 2023
e1b5dca
forecast choice labels
brettedw Oct 30, 2023
19c7057
moves api call to func, adds success/fail slice
brettedw Oct 30, 2023
8670144
backend
brettedw Oct 30, 2023
abae508
Get extra day of determinates for fwi calc
brettedw Oct 30, 2023
bbde898
Merge branch 'main' into task/simulated-indices
brettedw Oct 30, 2023
0684687
Fix router test, handle empty dates
conbrad Oct 31, 2023
a6cd4e6
Merge branch 'main' into task/simulated-indices
conbrad Oct 31, 2023
bfeb943
Merge branch 'main' into task/simulated-indices
brettedw Oct 31, 2023
12892bc
add backend tests for get_fwi_values
brettedw Oct 31, 2023
649ae55
code smell
brettedw Oct 31, 2023
7657c36
Add dataslice tests
conbrad Oct 31, 2023
4fc612c
Merge branch 'task/simulated-indices' of github.com:bcgov/wps into ta…
conbrad Oct 31, 2023
f6006cc
endpoint tests
brettedw Oct 31, 2023
f071f13
unused imports
brettedw Oct 31, 2023
d20bef9
processRowUpdate bug squasher?
brettedw Nov 1, 2023
cf624cd
smelly code
brettedw Nov 1, 2023
057d039
Merge branch 'main' into task/simulated-indices
brettedw Nov 1, 2023
8c1667a
Merge branch 'main' into task/simulated-indices
brettedw Nov 1, 2023
1a046f1
always be able to handle multiple stations
brettedw Nov 2, 2023
cb18c6b
clean up imports
brettedw Nov 2, 2023
3488ab1
Merge branch 'main' into task/simulated-indices
brettedw Nov 2, 2023
0159c1d
update test_forecasts test
brettedw Nov 6, 2023
f7354e1
deal with falsy 0's in backend
brettedw Nov 6, 2023
01dc387
adds util tests
brettedw Nov 6, 2023
400adaa
adds row filtering tests
brettedw Nov 6, 2023
3d410f1
Merge branch 'main' into task/simulated-indices
brettedw Nov 7, 2023
e9ec48d
row filter tests and rowFilters.ts
brettedw Nov 7, 2023
1b57b96
update rowFilters test
brettedw Nov 7, 2023
b4759bc
Merge branch 'main' into task/simulated-indices
brettedw Nov 7, 2023
776db25
rowFilters test refinement
brettedw Nov 7, 2023
708aecd
typos
brettedw Nov 7, 2023
a4fa721
camel to snake
brettedw Nov 8, 2023
983e4bf
add tests for mapForecastChoiceLabels
brettedw Nov 8, 2023
3c937f5
address some comments
brettedw Nov 8, 2023
59dc6f4
address more comments
brettedw Nov 8, 2023
f1472a4
Merge branch 'main' into task/simulated-indices
brettedw Nov 8, 2023
862f276
add tests for rowFilters returning undefined
brettedw Nov 8, 2023
5afe044
Merge branch 'main' into task/simulated-indices
brettedw Nov 9, 2023
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
23 changes: 12 additions & 11 deletions web/src/features/moreCast2/components/ForecastSummaryDataGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { styled } from '@mui/material/styles'
import { DataGrid, GridColDef, GridEventListener, GridCellEditStopParams } from '@mui/x-data-grid'
import { DataGrid, GridColDef, GridEventListener } from '@mui/x-data-grid'
import { ModelChoice, ModelType } from 'api/moreCast2API'
import { MoreCast2Row } from 'features/moreCast2/interfaces'
import { LinearProgress } from '@mui/material'
Expand Down Expand Up @@ -62,24 +62,25 @@ const ForecastSummaryDataGrid = ({
handleClose
}: ForecastSummaryDataGridProps) => {
const dispatch: AppDispatch = useDispatch()
const handleCellEditStop = async (params: GridCellEditStopParams) => {
const editedRow = params.row
dispatch(storeUserEditedRows([editedRow]))
const processRowUpdate = async (newRow: MoreCast2Row) => {
dispatch(storeUserEditedRows([newRow]))

const mustBeFilled = [
brettedw marked this conversation as resolved.
Show resolved Hide resolved
editedRow.tempForecast?.value,
editedRow.rhForecast?.value,
editedRow.windSpeedForecast?.value,
editedRow.precipForecast?.value
newRow.tempForecast?.value,
newRow.rhForecast?.value,
newRow.windSpeedForecast?.value,
newRow.precipForecast?.value
]
for (const value of mustBeFilled) {
if (isNaN(value)) {
return editedRow
return newRow
}
}
const idBeforeEditedRow = getYesterdayRowID(editedRow)
const idBeforeEditedRow = getYesterdayRowID(newRow)
const rowsForSimulation = rows.filter(row => row.id >= idBeforeEditedRow).filter(isActualOrValidForecastPredicate)
brettedw marked this conversation as resolved.
Show resolved Hide resolved
dispatch(getSimulatedIndices(rowsForSimulation))

return newRow
}

return (
Expand All @@ -98,7 +99,7 @@ const ForecastSummaryDataGrid = ({
columns={DataGridColumns.getSummaryColumns()}
rows={rows}
isCellEditable={params => params.row[params.field] !== ModelChoice.ACTUAL}
onCellEditStop={handleCellEditStop}
processRowUpdate={processRowUpdate}
/>
<ApplyToColumnMenu
colDef={clickedColDef}
Expand Down