From cea17acfd5ad7b98a0b837bbbc40b3475f158cce Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 20 Oct 2024 21:33:44 +0200 Subject: [PATCH] update --- app/cron_business_metrics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/cron_business_metrics.py b/app/cron_business_metrics.py index 430b41e..bb3d29d 100644 --- a/app/cron_business_metrics.py +++ b/app/cron_business_metrics.py @@ -242,6 +242,10 @@ def generate_geography_dataset(dataset): date = item.get('date') value = int(float(item.get('value', 0))) + year = int(date[:4]) + if year < 2019: + continue # Skip this item if the year is less than 2019 + # Replace country name if necessary country_name = country_replacements.get(name, 'Other') @@ -256,7 +260,7 @@ def generate_geography_dataset(dataset): # Convert the aggregated data back into the desired list format dataset = [{'name': country, 'date': date, 'value': total_value} for (country, date), total_value in aggregated_data.items()] - print(dataset) + dataset = aggregate_other_values(dataset) dataset = sorted( dataset,