fix hltb worker
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-04-02 21:23:00 +03:00
parent f820e86277
commit c84600ae3e
8 changed files with 71 additions and 9 deletions

View File

@@ -36,13 +36,15 @@ def fetch(game_name):
def apply_to_item(item):
"""Fetch HLTB data and save it onto item. Silently does nothing on failure."""
"""Fetch HLTB data and save it onto item. Always marks hltb_fetched=True."""
if item.category != 'games' or not item.name:
return
data = fetch(item.name)
if data is None:
return
item.hltb_main = data['main']
item.hltb_extra = data['extra']
item.hltb_complete = data['complete']
item.save(update_fields=['hltb_main', 'hltb_extra', 'hltb_complete'])
fields = ['hltb_fetched']
item.hltb_fetched = True
if data is not None:
item.hltb_main = data['main']
item.hltb_extra = data['extra']
item.hltb_complete = data['complete']
fields += ['hltb_main', 'hltb_extra', 'hltb_complete']
item.save(update_fields=fields)