Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

311218 - New results case NR 90 #1137

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions components/ResultsPage/SummaryEstimates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ export const SummaryEstimates: React.VFC<{

const partnerResult = partnerResults
? partnerResults.filter((elm) => elm).length > 0
? partnerResults.some((obj) => year in obj)
? partnerResults.includes(year)
? partnerResults.some((obj) => year in obj)
: null
: null
: null

let heading

if (year == currentYear) {
Expand Down Expand Up @@ -124,12 +127,16 @@ export const SummaryEstimates: React.VFC<{

return (
<div key={heading}>
<h3
className={`h3 ${index != 0 ? 'mt-5' : ''} mb-5`}
key={'heading' + heading}
>
{heading}
</h3>
{/* Print Heading if there is something to print */}
{(userResult || partnerResult) && (
<h3
className={`h3 ${index != 0 ? 'mt-5' : ''} mb-5`}
key={'heading' + heading}
>
{heading}
</h3>
)}

<div key={`estimation-${year}`} className="mb-5">
<div key={`estimation-sub-${year}`} className="space-y-4">
{userResult && (
Expand All @@ -153,7 +160,7 @@ export const SummaryEstimates: React.VFC<{
)}
</div>
{eligible &&
eligible.map((benefit: BenefitResult) => {
eligible.map((benefit: BenefitResult, index) => {
const collapsedDetails = benefit.cardDetail?.collapsedText
if (collapsedDetails) {
const index = collapsedDetails.findIndex(
Expand All @@ -169,11 +176,12 @@ export const SummaryEstimates: React.VFC<{
}

return (
<>
<div key={`CustomCollapse-${index}`}>
{collapsedDetails &&
collapsedDetails.map((detail, index) => {
if (!collapsed.includes(detail.heading)) {
collapsed.push(detail.heading)

return (
<CustomCollapse
datacy={`collapse-${benefit.benefitKey}-${index}`}
Expand All @@ -183,7 +191,6 @@ export const SummaryEstimates: React.VFC<{
>
<p
className="leading-[26px]"
key={`collapse-${detail.heading}-${index}`}
dangerouslySetInnerHTML={{
__html: detail.text,
}}
Expand All @@ -206,14 +213,18 @@ export const SummaryEstimates: React.VFC<{
)
}
})}
</>
</div>
)
})}
</div>

{/* Only display the <hr /> if there are results to show */}

{headings.length > 1 &&
index < year.length &&
index != headings.length - 1 && (
<hr className="border-[#676767] border-solid border-t border-opacity-25" />
index != headings.length - 1 &&
(userResult || partnerResult) && (
<hr className="border-[#6F6F6F] border-solid border-t border-opacity-25" />
)}
</div>
)
Expand Down
10 changes: 9 additions & 1 deletion utils/api/futureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,17 @@ export class FutureHandler {
}
})

//
// Remove from partnerResults all calculations when partner resides out of the country
//
result = {
client: clientResults.length !== 0 ? clientResults : null,
partner: partnerResults.length !== 0 ? partnerResults : null,
partner:
this.query.partnerLivingCountry === 'OTH'
? null
: partnerResults.length !== 0
? partnerResults
: null,
}
}

Expand Down