Skip to content

Commit 4582503

Browse files
authored
Add series date sorting to correct snap-to recency cut (#6137)
## Related PR [6047](#6047) ## Description The series needed to be sorted by date, so that the recency cut (five years) could be applied when determining date of highest coverage. ## Testing In searches such as "Demographics in Texas" or "Jobs in Texas", the ranking and map charts should all now once again mach production in terms of dates (see screenshots below). ## Screenshot ### Before <img width="1401" height="714" alt="Screenshot 2026-03-26 at 8 03 59 PM" src="https://github.com/user-attachments/assets/605297fc-d472-4be0-b6ef-7e8579df760d" /> ### After <img width="1387" height="712" alt="Screenshot 2026-03-26 at 8 02 38 PM" src="https://github.com/user-attachments/assets/41988a05-b459-461a-8983-df15697b5de6" />
1 parent a2911ca commit 4582503

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

server/services/datacommons.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ def get_series_dates(parent_entity, child_type, variables):
608608
for facet_id, count in facet_counts.items():
609609
entity_counts.append({"count": count, "facet": facet_id})
610610
obs_dates.append({"date": date, "entityCount": entity_counts})
611+
obs_dates.sort(key=lambda x: x['date'])
611612
resp_dates.append({"variable": var, "observationDates": obs_dates})
612613

613614
return {"datesByVariable": resp_dates, "facets": all_facets}

0 commit comments

Comments
 (0)