Skip to content

Commit

Permalink
some bugfixes for the achievements view
Browse files Browse the repository at this point in the history
  • Loading branch information
joschobart committed Sep 17, 2024
1 parent e9b1f34 commit 6286104
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fun_with_flags/achievements.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ def achievements():
g.fwf_matches_away = 0
try:
for _key in _my_document["history"]["friendlies"].keys():
# Don't count flags of abandoned teams in db
if not _key in session["my_team"].keys():
continue
for _place in "home", "away":
for _id in range(1, 200):
for _id in range(1, 250):
try:
_matches = _my_document["history"]["friendlies"][_key][
"opponent_country"
Expand Down Expand Up @@ -203,14 +206,14 @@ def achievements():

# pygal neighbor score plot
_neighbors = {g.user_id: {}}
for x in range(_position, (_position + 4)):
for x in range(_position, (_position + 3)):
try:
_neighbors[_score_list[x][0]] = {}
except IndexError:
continue

for x in range((_position - 4), _position):
if x < 1:
if x < 0:
continue
_neighbors[_score_list[x][0]] = {}

Expand Down Expand Up @@ -274,7 +277,7 @@ def achievements():
_competitors=_competitors,
_mean_score=_mean_score,
_median_score=_median_score,
_owned_badges=len(_owned_badges),
_owned_badges=len(session["badges"]),
_total_nr_badges=_total_nr_badges,
)
flash(_message)
Expand Down

0 comments on commit 6286104

Please sign in to comment.