diff --git a/backend/lcfs/utils/constants.py b/backend/lcfs/utils/constants.py index 793fe2a4e..24d0d43f1 100644 --- a/backend/lcfs/utils/constants.py +++ b/backend/lcfs/utils/constants.py @@ -55,6 +55,7 @@ class LCFS_Constants: ] TRANSACTIONS_EXPORT_SHEETNAME = "Transactions" TRANSACTIONS_EXPORT_FILENAME = "BC-LCFS-transactions" + LEGISLATION_TRANSITION_YEAR = "2024" class FILE_MEDIA_TYPE(Enum): @@ -93,5 +94,5 @@ class FILE_MEDIA_TYPE(Enum): "HDRD", "Other diesel", "Alternative jet fuel", - "Other" + "Other", ] diff --git a/backend/lcfs/web/api/allocation_agreement/repo.py b/backend/lcfs/web/api/allocation_agreement/repo.py index 080874369..02372d5a1 100644 --- a/backend/lcfs/web/api/allocation_agreement/repo.py +++ b/backend/lcfs/web/api/allocation_agreement/repo.py @@ -16,6 +16,7 @@ from lcfs.db.models.fuel.FuelCode import FuelCode from lcfs.db.models.fuel.FuelType import QuantityUnitsEnum +from lcfs.utils.constants import LCFS_Constants from lcfs.web.api.fuel_code.repo import FuelCodeRepository from lcfs.web.api.allocation_agreement.schema import AllocationAgreementSchema from lcfs.web.api.base import PaginationRequestSchema @@ -38,7 +39,8 @@ async def get_table_options(self, compliance_period: str) -> dict: """Get all table options""" fuel_categories = await self.fuel_code_repo.get_fuel_categories() fuel_types = await self.fuel_code_repo.get_formatted_fuel_types( - include_legacy=compliance_period < "2024" + include_legacy=compliance_period + < LCFS_Constants.LEGISLATION_TRANSITION_YEAR ) units_of_measure = [unit.value for unit in QuantityUnitsEnum] allocation_transaction_types = ( diff --git a/backend/lcfs/web/api/fuel_export/repo.py b/backend/lcfs/web/api/fuel_export/repo.py index 32598d45c..2624dec76 100644 --- a/backend/lcfs/web/api/fuel_export/repo.py +++ b/backend/lcfs/web/api/fuel_export/repo.py @@ -17,6 +17,7 @@ ) from lcfs.db.base import UserTypeEnum, ActionTypeEnum from lcfs.db.models.compliance.ComplianceReport import ComplianceReport +from lcfs.utils.constants import LCFS_Constants from lcfs.web.api.base import PaginationRequestSchema from sqlalchemy import and_, or_, select, func, delete from sqlalchemy.orm import joinedload, selectinload @@ -164,7 +165,7 @@ async def get_fuel_export_table_options(self, compliance_period: str): ) ) - include_legacy = compliance_period < "2024" + include_legacy = compliance_period < LCFS_Constants.LEGISLATION_TRANSITION_YEAR if not include_legacy: query = query.where(FuelType.is_legacy == False) diff --git a/backend/lcfs/web/api/fuel_supply/repo.py b/backend/lcfs/web/api/fuel_supply/repo.py index f90df203c..9de81b713 100644 --- a/backend/lcfs/web/api/fuel_supply/repo.py +++ b/backend/lcfs/web/api/fuel_supply/repo.py @@ -25,6 +25,7 @@ UnitOfMeasure, EndUseType, ) +from lcfs.utils.constants import LCFS_Constants from lcfs.web.api.base import PaginationRequestSchema from lcfs.web.api.fuel_supply.schema import FuelSupplyCreateUpdateSchema from lcfs.web.core.decorators import repo_handler @@ -184,7 +185,7 @@ async def get_fuel_supply_table_options(self, compliance_period: str): ) ) - include_legacy = compliance_period < "2024" + include_legacy = compliance_period < LCFS_Constants.LEGISLATION_TRANSITION_YEAR if not include_legacy: query.where(FuelType.is_legacy == False) @@ -474,7 +475,7 @@ async def get_effective_fuel_supplies( FuelSupply.version == valid_fuel_supplies_subq.c.max_version, user_type_priority == valid_fuel_supplies_subq.c.max_role_priority, ), - isouter=False # Explicit inner join + isouter=False, # Explicit inner join ) .order_by(FuelSupply.create_date.asc()) ) diff --git a/backend/lcfs/web/api/other_uses/repo.py b/backend/lcfs/web/api/other_uses/repo.py index 86ed3821b..63b90a495 100644 --- a/backend/lcfs/web/api/other_uses/repo.py +++ b/backend/lcfs/web/api/other_uses/repo.py @@ -16,6 +16,7 @@ from lcfs.db.models.fuel.FuelCode import FuelCode from lcfs.db.models.fuel.FuelType import FuelType, QuantityUnitsEnum from lcfs.db.models.fuel.FuelInstance import FuelInstance +from lcfs.utils.constants import LCFS_Constants from lcfs.web.api.fuel_code.repo import FuelCodeRepository from lcfs.web.api.other_uses.schema import OtherUsesSchema from lcfs.web.api.base import PaginationRequestSchema @@ -39,7 +40,8 @@ async def get_table_options(self, compliance_period: str) -> dict: """Get all table options""" fuel_categories = await self.fuel_code_repo.get_fuel_categories() fuel_types = await self.get_formatted_fuel_types( - include_legacy=compliance_period < "2024" + include_legacy=compliance_period + < LCFS_Constants.LEGISLATION_TRANSITION_YEAR ) expected_uses = await self.fuel_code_repo.get_expected_use_types() units_of_measure = [unit.value for unit in QuantityUnitsEnum]