Skip to content

Commit

Permalink
return only laborders
Browse files Browse the repository at this point in the history
  • Loading branch information
jabahum committed Jun 25, 2024
1 parent 4df82e2 commit 32ca35d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ const LaboratoryActiveTestOrderResults: React.FC<
encounterTypeUuid === laboratoryEncounterTypeUuid ||
encounterTypeUuid === artCardEncounterTypeUuid;

// Check if any order has a matching orderType UUID
const hasMatchingOrder = orders?.some(
// Filter orders to only include those with the matching orderType UUID
const matchingOrders = orders?.filter(
({ orderType }) => orderType?.uuid === laboratoryOrderTypeUuid
);

return isMatchingEncounterType && hasMatchingOrder;
// Return the item only if it has matching encounterType and at least one matching order
return isMatchingEncounterType && matchingOrders?.length > 0;
})
?.sort((a, b) => {
const dateA = new Date(a.encounterDatetime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ const LaboratoryOrderReferalResults: React.FC<
encounterTypeUuid === laboratoryEncounterTypeUuid ||
encounterTypeUuid === artCardEncounterTypeUuid;

// Check if any order has a matching orderType UUID
const hasMatchingOrder = orders?.some(
// Filter orders to only include those with the matching orderType UUID
const matchingOrders = orders?.filter(
({ orderType }) => orderType?.uuid === laboratoryOrderTypeUuid
);

return isMatchingEncounterType && hasMatchingOrder;
// Return the item only if it has matching encounterType and at least one matching order
return isMatchingEncounterType && matchingOrders?.length > 0;
})
?.sort((a, b) => {
const dateA = new Date(a.encounterDatetime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ const LaboratoryPastTestOrderResults: React.FC<
encounterTypeUuid === laboratoryEncounterTypeUuid ||
encounterTypeUuid === artCardEncounterTypeUuid;

// Check if any order has a matching orderType UUID
const hasMatchingOrder = orders?.some(
// Filter orders to only include those with the matching orderType UUID
const matchingOrders = orders?.filter(
({ orderType }) => orderType?.uuid === laboratoryOrderTypeUuid
);

return isMatchingEncounterType && hasMatchingOrder;
// Return the item only if it has matching encounterType and at least one matching order
return isMatchingEncounterType && matchingOrders?.length > 0;
})
?.sort((a, b) => {
const dateA = new Date(a.encounterDatetime);
Expand Down

0 comments on commit 32ca35d

Please sign in to comment.