From 2f263a85ebab641de3e2b9d2d7ecc29f71e29f7b Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 26 Aug 2024 00:42:38 +0200 Subject: [PATCH] some more refactoring for the neighbor plot in achievments view --- fun_with_flags/achievements.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/fun_with_flags/achievements.py b/fun_with_flags/achievements.py index e14bd79..16b352c 100644 --- a/fun_with_flags/achievements.py +++ b/fun_with_flags/achievements.py @@ -160,18 +160,12 @@ def achievements(): except Exception: _scores.append(None) - if _scores[0] is None: - try: - _scores[-1] = _my_neighbor_doc["score"]["score"] - _scores[-2] = _my_neighbor_doc["score"]["score"] - except KeyError: - continue - + if not "history" in _my_neighbor_doc["score"].keys(): + _scores[-1] = _my_neighbor_doc["score"]["score"] + _scores[-2] = _my_neighbor_doc["score"]["score"] + if _scores[-1] is None: - try: - _scores[-1] = _my_neighbor_doc["score"]["score"] - except KeyError: - continue + _scores[-1] = _my_neighbor_doc["score"]["score"] if _neighbor == g.user_id: line_chart.add("You", _scores)