Skip to content

Commit 7385a68

Browse files
committed
Fix CLOE 1 month toggle to fetch 30 days of data
1 parent 927aee0 commit 7385a68

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

frontend/src/pages/DataViewPage/CloeDataViewPage.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ enum TimeRange {
3939
OneMonth = '1month',
4040
}
4141

42+
const CLOE_FETCH_WINDOW_DAYS = 30
43+
const CLOE_PAGE_SIZE = 200
44+
const MS_PER_SECOND = 1000
45+
const MS_PER_DAY = 24 * 60 * 60 * MS_PER_SECOND
46+
4247
enum CloeMissionNames {
4348
Avlesning = 'Avlesning',
4449
}
@@ -141,12 +146,15 @@ export const CloeDataViewPage = () => {
141146
const backendApi = useBackendApi()
142147

143148
const fetchMissions = (): Promise<Mission[]> => {
149+
const minEndTime = Math.floor((Date.now() - CLOE_FETCH_WINDOW_DAYS * MS_PER_DAY) / MS_PER_SECOND)
144150
return backendApi
145151
.getMissionRuns({
146152
installationCode: installation.installationCode,
147153
orderBy: 'EndTime desc, Name',
148154
statuses: [MissionStatus.Successful, MissionStatus.PartiallySuccessful],
149155
nameSearch: CloeMissionNames.Avlesning,
156+
minEndTime: minEndTime,
157+
pageSize: CLOE_PAGE_SIZE,
150158
})
151159
.then((missionRuns) => {
152160
const missions = missionRuns.content

0 commit comments

Comments
 (0)