Skip to content

Commit c740963

Browse files
authored
Merge pull request #291 from IFRCGo/fix/emergency-report-document-count
Fix emergency report document count
2 parents 38711c8 + 624ff66 commit c740963

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function ActiveDrefTable(props: Props) {
117117
const opsUpdateList = operational_update_details;
118118
return opsUpdateList[0];
119119
}
120+
120121
return dref;
121122
},
122123
[],

src/views/EmergencyReportAndDocument/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function Component() {
5151
const { emergencyResponse } = useOutletContext<EmergencyOutletContext>();
5252
const {
5353
page: appealDocumentsPage,
54+
offset: appealDocumentsOffset,
5455
setPage: setAppealDocumentsPage,
5556
limit: appealDocumentsLimit,
5657
} = useFilterState<object>({
@@ -93,7 +94,7 @@ export function Component() {
9394
*/
9495
appeal: emergencyResponse.appeals.map((appeal) => appeal.id).filter(isDefined),
9596
limit: appealDocumentsLimit,
96-
offset: appealDocumentsPage,
97+
offset: appealDocumentsOffset,
9798
} : undefined,
9899
});
99100

@@ -317,7 +318,7 @@ export function Component() {
317318
<Container
318319
heading={resolveToString(
319320
strings.fieldReports,
320-
{ count: emergencyResponse.field_reports.length },
321+
{ count: emergencyResponse.field_reports.length ?? '--' },
321322
)}
322323
withHeaderBorder
323324
footerActions={(
@@ -345,7 +346,7 @@ export function Component() {
345346
<Container
346347
heading={resolveToString(
347348
strings.appealDocuments,
348-
{ count: appealDocumentsResponse?.count },
349+
{ count: appealDocumentsResponse?.count ?? '--' },
349350
)}
350351
withHeaderBorder
351352
footerActions={(

src/views/EmergencySurge/SurgeTable/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,17 @@ export default function SurgeTable(props: Props) {
9595
'duration',
9696
strings.surgeAlertDuration,
9797
(item) => {
98-
if (isNotDefined(item.created_at) || isNotDefined(item.end)) {
98+
if (isNotDefined(item.start) || isNotDefined(item.end)) {
9999
return undefined;
100100
}
101101

102-
const alertDate = new Date(item.created_at);
102+
const alertDate = new Date(item.start);
103103
const deadline = new Date(item.end);
104+
105+
if (alertDate > deadline) {
106+
return undefined;
107+
}
108+
104109
const duration = getDuration(alertDate, deadline);
105110

106111
return duration;
@@ -117,11 +122,11 @@ export default function SurgeTable(props: Props) {
117122
const startDate = new Date(item.start);
118123
const nowMs = new Date().getTime();
119124

120-
const duration = startDate.getTime() < nowMs
125+
const start = startDate.getTime() < nowMs
121126
? strings.emergencySurgeImmediately
122127
: startDate.toLocaleString();
123128

124-
return duration;
129+
return start;
125130
},
126131
),
127132
createStringColumn<SurgeListItem, number>(

0 commit comments

Comments
 (0)