From dbc3fd4ea6a04f92649ca1f7845af91a87a771db Mon Sep 17 00:00:00 2001 From: ross-spencer Date: Sat, 30 Nov 2024 15:11:00 +0100 Subject: [PATCH] Add rudimentary country count --- src/itn_api/htm_helpers.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/itn_api/htm_helpers.py b/src/itn_api/htm_helpers.py index c1be6d0..f8e6630 100644 --- a/src/itn_api/htm_helpers.py +++ b/src/itn_api/htm_helpers.py @@ -55,13 +55,7 @@ def aliases_to_html(alias_report: dict) -> str: count_row = f""" - - - - - - - Count + Count  {count}  @@ -118,7 +112,8 @@ def locations_table(locations): seen = [] rows = "" - for locale in locations: + idx = 0 + for idx, locale in enumerate(locations): region = locale["region"] country = locale["country"] if (region, country) in seen: @@ -131,5 +126,11 @@ def locations_table(locations): """.strip() seen.append((region, country)) rows = f"{rows}{row}\n" + country_count = f""" + + Count +  {idx}  + + """.strip() - return f"{head}\n{rows}\n" + return f"{head}\n{rows}\n{country_count}\n"