Skip to content

Commit

Permalink
fix: use same upload date throughout api-calls when not passed
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Oct 14, 2024
1 parent bc34903 commit d2861a6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions services/API-service/src/scripts/mock.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class MockService {
if (mockBody.removeEvents) {
await this.removeEvents(mockBody.countryCodeISO3, disasterType);
}
const date = mockBody.date || new Date();

const selectedCountry = countries.find((country) => {
if (mockBody.countryCodeISO3 === country.countryCodeISO3) {
Expand Down Expand Up @@ -121,7 +122,7 @@ export class MockService {
adminLevel: adminLevel,
disasterType: disasterType,
eventName: null,
date: mockBody.date,
date: date,
});
}
}
Expand Down Expand Up @@ -152,7 +153,7 @@ export class MockService {
adminLevel: adminLevel,
disasterType: disasterType,
eventName: event.eventName,
date: mockBody.date,
date: date,
});
}
}
Expand All @@ -167,7 +168,7 @@ export class MockService {
triggersPerLeadTime,
disasterType: DisasterType.Floods,
eventName: event.eventName,
date: mockBody.date,
date: date,
});
}

Expand All @@ -180,7 +181,7 @@ export class MockService {
await this.mockGlofasStations(
selectedCountry,
DisasterType.Floods,
mockBody.date,
date,
scenario.scenarioName,
event,
);
Expand All @@ -202,7 +203,7 @@ export class MockService {
await this.mockGlofasStations(
selectedCountry,
disasterType,
mockBody.date,
date,
scenario.scenarioName,
);
}
Expand All @@ -213,15 +214,15 @@ export class MockService {
await this.mockHelpService.mockExposedAssets(
selectedCountry.countryCodeISO3,
triggered,
mockBody.date,
date,
);
}
if (this.shouldMockDynamicPointData(disasterType)) {
// TODO: the below methods still assume hard-coded leadTimes and is not flexible
await this.mockHelpService.mockDynamicPointData(
selectedCountry.countryCodeISO3,
disasterType,
mockBody.date,
date,
);
}

Expand Down

0 comments on commit d2861a6

Please sign in to comment.