Fix F&B last-7-days fill to span month boundary
"Fill F&B from last 7 days" only drew from the current month's elapsed days, so early in a month (e.g. the 3rd) it only had 1-2 actual days to repeat instead of a true trailing 7-day window. Add a dedicated last7-fnb endpoint that fetches a real 7-day window ending yesterday, reaching back into the prior month when needed.
This commit is contained in:
parent
d1c50c77d0
commit
73d2c713d4
3 changed files with 51 additions and 5 deletions
|
|
@ -52,6 +52,18 @@ export function dfGetReport(year: number, month: number, dowAlign = true): Promi
|
|||
return request<ForecastReportData>(`/directors-forecast/report/${year}/${month}?dow_align=${dowAlign}`)
|
||||
}
|
||||
|
||||
export type Last7FnBDay = {
|
||||
date: string
|
||||
actual_dry: number | null
|
||||
actual_wet: number | null
|
||||
forecast_dry: number | null
|
||||
forecast_wet: number | null
|
||||
}
|
||||
|
||||
export function dfGetLast7Fnb(): Promise<{ days: Last7FnBDay[] }> {
|
||||
return request<{ days: Last7FnBDay[] }>('/directors-forecast/last7-fnb')
|
||||
}
|
||||
|
||||
export function dfSaveSnapshot(year: number, month: number, data: object) {
|
||||
return request(`/directors-forecast/report/${year}/${month}/snapshot`, {
|
||||
method: 'POST', body: JSON.stringify(data),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue