master.py: also update title CSS

This commit is contained in:
Lephe 2021-07-08 17:52:54 +02:00
parent 59236cac70
commit 64a6f270c5
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 8 additions and 1 deletions

View File

@ -175,14 +175,21 @@ def update_trophies():
# Add missing trophies
for name, t in tr.items():
description = t.get("description", "")
css = t.get("css", "")
trophy = Trophy.query.filter_by(name=name).first()
if "css" in t and not t["is_title"]:
print(f"[trophies] CSS on '{name}' is meaningless (not a title)")
# Updating existing trophies
if trophy is not None:
changes = (trophy.description != description) or \
(trophy.hidden != t["hidden"])
(trophy.hidden != t["hidden"] or (isinstance(trophy,Title) and \
trophy.css != css))
trophy.description = description
trophy.hidden = t["hidden"]
if isinstance(trophy, Title):
trophy.css = css
if changes:
print(f"[trophies] Updated '{name}'")