From 13f3af7a42bd65c713215b5a29e30faffc3e84a9 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Sun, 3 Aug 2025 20:03:15 +0500 Subject: [PATCH] fix(hltb): return None if all time zero Signed-off-by: Boris Yumankulov --- portprotonqt/howlongtobeat_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/portprotonqt/howlongtobeat_api.py b/portprotonqt/howlongtobeat_api.py index 03409d1..eb3ac7e 100644 --- a/portprotonqt/howlongtobeat_api.py +++ b/portprotonqt/howlongtobeat_api.py @@ -219,9 +219,11 @@ class ResultParser: ("comp_plus", "main_extra"), ("comp_100", "completionist") ] + all_zero = all(game_data.get(json_field, 0) == 0 for json_field, _ in time_fields) for json_field, attr_name in time_fields: if json_field in game_data: - time_hours = round(game_data[json_field] / 3600, 2) + time_seconds = game_data[json_field] + time_hours = None if all_zero else round(time_seconds / 3600, 2) setattr(game, attr_name, time_hours) game.similarity = self._calculate_similarity(game) return game