Skip to content

Commit

Permalink
Add rudimentary country count
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed Nov 30, 2024
1 parent 301c2ea commit dbc3fd4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/itn_api/htm_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ def aliases_to_html(alias_report: dict) -> str:

count_row = f"""
<tr>
<td></td>
<td nowrap></td>
<td nowrap></td>
<td></td>
</tr>
<tr>
<td>Count</td>
<td><b>Count</b></td>
<td nowrap>&nbsp;{count}&nbsp;</td>
<td nowrap></td>
<td></td>
Expand Down Expand Up @@ -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:
Expand All @@ -131,5 +126,11 @@ def locations_table(locations):
""".strip()
seen.append((region, country))
rows = f"{rows}{row}\n"
country_count = f"""
<tr>
<td><b>Count</b></td>
<td nowrap>&nbsp;{idx}&nbsp;</td>
</tr>
""".strip()

return f"{head}\n{rows}</table>\n"
return f"{head}\n{rows}\n{country_count}</table>\n"

0 comments on commit dbc3fd4

Please sign in to comment.