Skip to content

Commit

Permalink
fix: resolve issues in alteration sum for the applicant (hl-1504 cont…
Browse files Browse the repository at this point in the history
….) (#3446)

* fix: expose calculated_benefit_amount for old ahjo path as well

* fix: there was never a calculation object in applicant side
  • Loading branch information
sirtawast authored Oct 21, 2024
1 parent 4bbee48 commit 09ff6c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 8 additions & 5 deletions backend/benefit/applications/api/v1/serializers/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,16 @@ class Meta:
calculated_benefit_amount = serializers.SerializerMethodField()

def get_calculated_benefit_amount(self, obj):
# Check if ahjo_status is None or does not have any related objects
if obj.ahjo_status is None or not obj.ahjo_status.exists():
return None
if obj.handled_by_ahjo_automation:
# Check if ahjo_status is None or does not have any related objects
if obj.ahjo_status is None or not obj.ahjo_status.exists():
return None

latest_status = obj.ahjo_status.latest().status
latest_status = obj.ahjo_status.latest().status

if latest_status != AhjoStatusEnum.DETAILS_RECEIVED_FROM_AHJO:
if latest_status != AhjoStatusEnum.DETAILS_RECEIVED_FROM_AHJO:
return None
elif obj.batch is None:
return None
return obj.calculated_benefit_amount

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ const PageContent: React.FC = () => {
key: 'status',
},
{
accessor: (app) =>
formatFloatToCurrency(app?.calculation?.calculatedBenefitAmount),
accessor: (app) => formatFloatToCurrency(app?.calculatedBenefitAmount),
key: 'benefitAmount',
showIf: () => showMonetaryFields,
},
Expand Down

0 comments on commit 09ff6c0

Please sign in to comment.