fix table create

This commit is contained in:
Sarah 2022-04-08 22:01:58 +01:00
parent b4ed2381d5
commit 90f238c56f
3 changed files with 23 additions and 12 deletions

View File

@ -17,11 +17,15 @@ def get_films_by_reference(viewings):
def build_page(films_by_reference_keyword):
reference_keywords_sorted = OrderedDict(sorted(films_by_reference_keyword.items(), key=lambda t: t[0]))
films_by_reference_table = "| Referenced | Films |\n| - | - |"
table = "| Referenced | Films |\n| - | - |"
for year in reference_keywords_sorted.keys():
films_by_reference_table += "\n"
films_by_reference_table += str(string.capwords(year[13:].replace("-", " "))) + " | "
films_by_reference_table += VCinemaUtils.get_film_list(reference_keywords_sorted[year])
table += "\n"
return films_by_reference_table
row_data = []
row_data.append(str(string.capwords(year[13:].replace("-", " "))))
row_data.append(VCinemaUtils.get_film_list(reference_keywords_sorted[year]))
table += " | ".join(row_data)
return table

View File

@ -54,14 +54,17 @@ def build_table(films_by_country):
for country, films in films_by_country_sorted.items():
table += "\n"
table += country
row_data = []
country_label = country
if country in flags.keys():
table += " "
table += flags[country]
country_label += " "
country_label += flags[country]
table += " | "
table += VCinemaUtils.get_film_list(films)
row_data.append(country_label)
row_data.append(VCinemaUtils.get_film_list(films))
table += " | ".join(row_data)
return table

View File

@ -19,7 +19,11 @@ def build_page(films_by_year):
for year in films_by_year_sorted.keys():
page += "\n"
page += str(year) + " | "
page += VCinemaUtils.get_film_list(films_by_year_sorted[year])
row_data = []
row_data.append(str(year))
row_data.append(VCinemaUtils.get_film_list(films_by_year_sorted[year]))
page += " | ".join(row_data)
return page