Skip to content

Commit

Permalink
Fix: Credit Offset Exclude Reserved (#2876)
Browse files Browse the repository at this point in the history
* fix: updated org service calculation for max credit offset to account for credit earning order over time

* fix: pending deductions calc change

* fix: None check on summary obj

* fix: added back exclude reserved

---------

Co-authored-by: Your Name <you@example.com>
  • Loading branch information
AlexZorkin and Your Name committed Apr 22, 2024
1 parent 7c210f3 commit 6f58128
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions backend/api/serializers/ComplianceReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,18 @@ def get_max_credit_offset(self, obj):

return max_credit_offset

def get_max_credit_offset_exclude_reserved(self, obj):
max_credit_offset_exclude_reserved = OrganizationService.get_max_credit_offset(
obj.organization,
obj.compliance_period.description,
exclude_reserved=True
)

if max_credit_offset_exclude_reserved < 0:
max_credit_offset_exclude_reserved = 0

return max_credit_offset_exclude_reserved

def get_summary(self, obj):
"""
Retrieve a summary that merges synthetic totals with existing summary data.
Expand Down Expand Up @@ -1255,6 +1267,18 @@ def get_max_credit_offset(self, obj):

return max_credit_offset

def get_max_credit_offset_exclude_reserved(self, obj):
max_credit_offset_exclude_reserved = OrganizationService.get_max_credit_offset(
obj.organization,
obj.compliance_period.description,
exclude_reserved=True
)

if max_credit_offset_exclude_reserved < 0:
max_credit_offset_exclude_reserved = 0

return max_credit_offset_exclude_reserved

def get_history(self, obj):
"""
Returns all the previous status changes for the compliance report
Expand Down

0 comments on commit 6f58128

Please sign in to comment.