Skip to content

Commit cbafbbc

Browse files
authored
feat: adding logging (#372)
2 parents 98e81ff + 96620d7 commit cbafbbc

File tree

1 file changed

+18
-1
lines changed
  • enterprise_access/apps/subsidy_access_policy

1 file changed

+18
-1
lines changed

enterprise_access/apps/subsidy_access_policy/models.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,11 +1273,20 @@ def can_allocate(self, number_of_learners, content_key, content_price_cents):
12731273

12741274
# Use all of these pieces to ensure that the assignments to potentially
12751275
# allocate won't exceed the remaining balance of the related subsidy.
1276+
subsidy_balance = self.subsidy_balance()
12761277
if self.content_would_exceed_limit(
12771278
total_allocated_and_spent_cents,
1278-
self.subsidy_balance(),
1279+
subsidy_balance,
12791280
positive_total_price_cents,
12801281
):
1282+
logger.info(
1283+
f'content_would_exceed_limit function: '
1284+
f'subsidy_uuid={self.subsidy_uuid}, '
1285+
f'policy_uuid={self.uuid},'
1286+
f'total_allocated_and_spent_centers={total_allocated_and_spent_cents}, '
1287+
f'subsidy_balance={subsidy_balance}, '
1288+
f'positive_total_price_cents={positive_total_price_cents}, '
1289+
)
12811290
return (False, REASON_NOT_ENOUGH_VALUE_IN_SUBSIDY)
12821291

12831292
# Lastly, use all of these pieces to ensure that the assignments to potentially
@@ -1287,6 +1296,14 @@ def can_allocate(self, number_of_learners, content_key, content_price_cents):
12871296
self.spend_limit,
12881297
positive_total_price_cents,
12891298
):
1299+
logger.info(
1300+
f'content_would_exceed_limit function: '
1301+
f'subsidy_uuid={self.subsidy_uuid}, '
1302+
f'policy_uuid={self.uuid}, '
1303+
f'total_allocated_and_spent_centers={total_allocated_and_spent_cents}, '
1304+
f'spend_limit={self.spend_limit}, '
1305+
f'positive_total_price_cents={positive_total_price_cents}, '
1306+
)
12901307
return (False, REASON_POLICY_SPEND_LIMIT_REACHED)
12911308

12921309
return (True, None)

0 commit comments

Comments
 (0)