Skip to content

Commit

Permalink
fix cpi not sorted (#6930)
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone authored Nov 4, 2024
1 parent 8200b59 commit 0c30302
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,6 @@ def transform_data(
query: OECDCPIQueryParams, data: List[Dict], **kwargs: Any
) -> List[OECDCPIData]:
"""Transform the data from the OECD endpoint."""
return [OECDCPIData.model_validate(d) for d in data]
return [
OECDCPIData.model_validate(d) for d in sorted(data, key=lambda x: x["date"])
]
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,7 @@ def transform_data(
query: OECDLTIRQueryParams, data: List[Dict], **kwargs: Any
) -> List[OECDLTIRData]:
"""Transform the data from the OECD endpoint."""
return [OECDLTIRData.model_validate(d) for d in data]
return [
OECDLTIRData.model_validate(d)
for d in sorted(data, key=lambda x: x["date"])
]
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,7 @@ def transform_data(
query: OECDSTIRQueryParams, data: List[Dict], **kwargs: Any
) -> List[OECDSTIRData]:
"""Transform the data from the OECD endpoint."""
return [OECDSTIRData.model_validate(d) for d in data]
return [
OECDSTIRData.model_validate(d)
for d in sorted(data, key=lambda x: x["date"])
]

0 comments on commit 0c30302

Please sign in to comment.