Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ensure all transactions are included in the export - 2068 #2118

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/lcfs/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ class FILE_MEDIA_TYPE(Enum):
"Transfer": "CT",
"AdminAdjustment": "AA",
"InitiativeAgreement": "IA",
"ComplianceReport": "CR",
}

id_prefix_to_transaction_type_map = {
"CT": "Transfer",
"AA": "AdminAdjustment",
"IA": "InitiativeAgreement",
"CR": "ComplianceReport",
}

default_ci = {"Gasoline": 93.67, "Diesel": 100.21, "Jet fuel": 88.83}
Expand Down
19 changes: 7 additions & 12 deletions backend/lcfs/web/api/transaction/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def apply_transaction_filters(self, pagination, conditions):
# check if the date string is selected for filter
if filter.filter is None:
filter_value = [
datetime.strptime(filter.date_from, "%Y-%m-%d %H:%M:%S").strftime(
"%Y-%m-%d"
)
datetime.strptime(
filter.date_from, "%Y-%m-%d %H:%M:%S"
).strftime("%Y-%m-%d")
]
if filter.date_to:
filter_value.append(
datetime.strptime(filter.date_to, "%Y-%m-%d %H:%M:%S").strftime(
"%Y-%m-%d"
)
datetime.strptime(
filter.date_to, "%Y-%m-%d %H:%M:%S"
).strftime("%Y-%m-%d")
)
if filter.field == "status":
field = cast(
Expand Down Expand Up @@ -189,12 +189,7 @@ async def export_transactions(
results = await self.repo.get_transactions_paginated(
0,
None,
[
or_(
TransactionView.status == "Approved",
TransactionView.status == "Recorded",
)
],
[TransactionView.status != "Deleted"],
[],
organization_id,
)
Expand Down