Skip to content

Commit 8cd562f

Browse files
author
James Fuqian
committed
fix retry expire check, add eobData.entry check on client, etc.
1 parent de35fa4 commit 8cd562f

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

client/src/components/records.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ export default function Records({ }) {
3131
.then(res => {
3232
return res.json();
3333
}).then(eobData => {
34-
const records: EOBRecord[] = eobData.entry.map((resourceData: any) => {
35-
const resource = resourceData.resource;
36-
return {
37-
id: resource.id,
38-
code: resource.item[0]?.productOrService?.coding[0]?.code || 'Unknown',
39-
display: resource.item[0]?.productOrService?.coding[0]?.display || 'Unknown Prescription Drug',
40-
amount: resource.item[0]?.adjudication[7]?.amount?.value || '0'
41-
}
42-
});
43-
setRecords(records);
34+
if (eobData && eobData.entry) {
35+
const records: EOBRecord[] = eobData.entry.map((resourceData: any) => {
36+
const resource = resourceData.resource;
37+
return {
38+
id: resource.id,
39+
code: resource.item[0]?.productOrService?.coding[0]?.code || 'Unknown',
40+
display: resource.item[0]?.productOrService?.coding[0]?.display || 'Unknown Prescription Drug',
41+
amount: resource.item[0]?.adjudication[7]?.amount?.value || '0'
42+
}
43+
});
44+
setRecords(records);
45+
}
4446
});
4547
}, [])
4648

server/src/utils/queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function do_retry() {
4949
break;
5050
}
5151
else if (r.tried()) {
52-
// max not reached yet
52+
// max not reached yet (not expired)
5353
RetryableRequests.enQ(r);
5454
}
5555
}

server/src/utils/retry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class Retryable {
5151
console.log("count=", this.count)
5252
this.count=this.count + 1;
5353
console.log("after count=", this.count)
54-
return this.expired();
54+
return !this.expired();
5555
}
5656

5757
expired() {

0 commit comments

Comments
 (0)