From b340074806a96e5f5e6f2b598c19506a9b99969e Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Thu, 14 Nov 2024 16:08:10 -0800 Subject: [PATCH] fix: Add sorting back to Fuel Supply * Was accidentally removed as part of adding versioning --- backend/lcfs/web/api/fuel_supply/repo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/lcfs/web/api/fuel_supply/repo.py b/backend/lcfs/web/api/fuel_supply/repo.py index 88eeaf0d..ecc6029b 100644 --- a/backend/lcfs/web/api/fuel_supply/repo.py +++ b/backend/lcfs/web/api/fuel_supply/repo.py @@ -1,5 +1,5 @@ import structlog -from typing import List, Optional +from typing import List, Optional, Sequence from fastapi import Depends from sqlalchemy import and_, delete, or_, select, case from sqlalchemy import func @@ -360,7 +360,7 @@ async def get_latest_fuel_supply_by_group_uuid( @repo_handler async def get_effective_fuel_supplies( self, compliance_report_group_uuid: str - ) -> List[FuelSupply]: + ) -> Sequence[FuelSupply]: """ Retrieve effective FuelSupply records associated with the given compliance_report_group_uuid. For each group_uuid: @@ -436,6 +436,7 @@ async def get_effective_fuel_supplies( user_type_priority == valid_fuel_supplies_subq.c.max_role_priority, ), ) + .order_by(FuelSupply.create_date.asc()) ) # Step 5: Execute the query and retrieve results using unique()