Skip to content

Commit

Permalink
Merge pull request #2568 from bcgov/fix/alex-credit-transfer-excel-2536
Browse files Browse the repository at this point in the history
Fix: Credit Transaction Excel Effective Date - 2536
  • Loading branch information
AlexZorkin committed Aug 29, 2023
2 parents 7a130db + 2687649 commit 869f6da
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/api/services/SpreadSheetBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ def add_credit_transfers(self, credit_trades, user):
worksheet.write(row_index, 8, "Signed")
else:
worksheet.write(row_index, 8, credit_trade.status.friendly_name)

if credit_trade.trade_effective_date:
worksheet.write(row_index, 9, credit_trade.trade_effective_date, date_format)
elif credit_trade.type.the_type in ["Credit Reduction", "Credit Validation"] and credit_trade.update_timestamp:
worksheet.write(row_index, 9, credit_trade.update_timestamp.date(), date_format)

# If the trade doesn't have an effective date but meets certain other criteria, write the update timestamp.
if credit_trade.update_timestamp:
# Conditions for using the update timestamp.
approved_status = credit_trade.status.status == "Approved"
valid_trade_type = credit_trade.type.the_type in ["Credit Reduction", "Credit Validation"]

if approved_status or valid_trade_type:
worksheet.write(row_index, 9, credit_trade.update_timestamp.date(), date_format)

comments = credit_trade.unprivileged_comments

Expand Down

0 comments on commit 869f6da

Please sign in to comment.