Skip to content

Commit

Permalink
remove print lines
Browse files Browse the repository at this point in the history
  • Loading branch information
prv-proton authored and Your Name committed Aug 30, 2023
1 parent 4ea7b55 commit 504f726
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/api/services/OrganizationService.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def get_pending_transfers_value(organization):
Q(is_rescinded=False) &
(Q(trade_effective_date__gte=datetime.datetime.now()) | Q(trade_effective_date__isnull=True)))
).aggregate(total_credits=Sum('number_of_credits'))

if pending_trades['total_credits'] is not None:
pending_transfers_value = pending_trades['total_credits']

Expand Down Expand Up @@ -57,6 +58,7 @@ def get_pending_deductions(
"Deleted"
])
).filter(id=group_id).first()

if compliance_report and compliance_report.summary:
if compliance_report.supplements_id and \
compliance_report.supplements_id > 0:
Expand Down Expand Up @@ -110,6 +112,7 @@ def get_pending_deductions(
# if report.status.director_status_id == 'Accepted' and \
# ignore_pending_supplemental:
# deductions -= report.summary.credits_offset

if deductions < 0:
deductions = 0

Expand All @@ -123,6 +126,7 @@ def get_max_credit_offset(organization, compliance_year, exclude_reserved=False)
compliance_period_effective_date = datetime.date(
int(compliance_year), 1, 1
)

credits = CreditTrade.objects.filter(
(Q(status__status="Approved") &
Q(type__the_type="Sell") &
Expand All @@ -147,6 +151,7 @@ def get_max_credit_offset(organization, compliance_year, exclude_reserved=False)
Q(is_rescinded=False) &
Q(compliance_period__effective_date__lte=compliance_period_effective_date))
).aggregate(total=Sum('number_of_credits'))

debits = CreditTrade.objects.filter(
(Q(status__status="Approved") &
Q(type__the_type="Sell") &
Expand All @@ -164,6 +169,7 @@ def get_max_credit_offset(organization, compliance_year, exclude_reserved=False)
Q(is_rescinded=False) &
Q(compliance_period__effective_date__lte=compliance_period_effective_date))
).aggregate(total=Sum('number_of_credits'))

total_in_compliance_period = 0
if credits and credits.get('total') is not None:
total_in_compliance_period = credits.get('total')
Expand All @@ -178,8 +184,10 @@ def get_max_credit_offset(organization, compliance_year, exclude_reserved=False)
validated_credits = organization.organization_balance.get(
'validated_credits', 0
)

total_balance = validated_credits - pending_deductions
total_available_credits = min(total_in_compliance_period, total_balance)

if total_available_credits < 0:
total_available_credits = 0

Expand Down

0 comments on commit 504f726

Please sign in to comment.