Skip to content

Commit

Permalink
Fix: Supp report logic - 2867 (#2874)
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

---------

Co-authored-by: Your Name <you@example.com>
  • Loading branch information
AlexZorkin and Your Name committed Apr 19, 2024
1 parent 06fd9cc commit 8c8b5db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
24 changes: 0 additions & 24 deletions backend/api/serializers/ComplianceReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,18 +592,6 @@ 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 @@ -1267,18 +1255,6 @@ 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
6 changes: 3 additions & 3 deletions backend/api/services/OrganizationService.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def get_pending_deductions(
if compliance_report.summary.credits_offset is not None:
deductions += compliance_report.summary.credits_offset

# if report.status.director_status_id == 'Accepted' and \
# ignore_pending_supplemental:
# deductions -= report.summary.credits_offset
if report.status.director_status_id == 'Accepted' and \
ignore_pending_supplemental:
deductions -= report.summary.credits_offset
if deductions < 0:
deductions = 0

Expand Down

0 comments on commit 8c8b5db

Please sign in to comment.