mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-05 22:51:36 +01:00
fix various problem reported by users
This commit is contained in:
12
api.py
12
api.py
@@ -75,13 +75,14 @@ def getPlayerRatingFromApi(playerName, WATCHER):
|
||||
except requests.exceptions.HTTPError as e:
|
||||
# not found #
|
||||
if e.response.status_code == 404:
|
||||
addToDB(playerName, 0)
|
||||
addToDB(playerName, DEFAULT_RATING)
|
||||
return DEFAULT_RATING
|
||||
# rate limit
|
||||
elif e.response.status_code == 429:
|
||||
print("Ratelimit reached")
|
||||
time.sleep(120)
|
||||
continue
|
||||
#time.sleep(120)
|
||||
#continue
|
||||
return DEFAULT_RATING
|
||||
else:
|
||||
raise e
|
||||
if not pTmp:
|
||||
@@ -95,8 +96,9 @@ def getPlayerRatingFromApi(playerName, WATCHER):
|
||||
except requests.exceptions.HTTPError as e:
|
||||
if e.response.status_code == 429:
|
||||
print("Ratelimit reached")
|
||||
time.sleep(120)
|
||||
continue
|
||||
return DEFAULT_RATING
|
||||
#time.sleep(120)
|
||||
#continue
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
||||
@@ -323,8 +323,11 @@ def balanceTool():
|
||||
retDict["left"].update( { positions[i] : bestOptionWithRating[i].name })
|
||||
retDict["right"].update({ positions[i] : bestOptionWithRating[i+5].name })
|
||||
|
||||
import sys
|
||||
print(flask.request.json, file=sys.stderr)
|
||||
print(retDict, file=sys.stderr)
|
||||
renderContent = flask.render_template("balance_response_partial.html", d=retDict,
|
||||
requests=flask.request.json,
|
||||
reqJson=flask.request.json,
|
||||
positions=positions,
|
||||
ratings=bestOptionRatings,
|
||||
qualityPositions=int(theoMin/best*100),
|
||||
|
||||
@@ -11,12 +11,16 @@
|
||||
{{ positions[x] }}
|
||||
</div>
|
||||
<div class="col-sm"
|
||||
{% if requests[leftP][x] | int >= 4 %}style="background: red;"{% endif %}>
|
||||
{{ leftP }} ({{ ratings[x] }})
|
||||
{% if reqJson.get(leftP) and reqJson.get(leftP)[x] | int >= 4 %}
|
||||
style="background: red;"
|
||||
{% endif %}>
|
||||
{{ leftP }} ({{ ratings[x] }})
|
||||
</div>
|
||||
<div class="col-sm"
|
||||
{% if requests[rightP][x] | int >= 4 %}style="background: red;"{% endif %}>
|
||||
{{ rightP }} ({{ ratings[x+5] }})
|
||||
{% if reqJson.get(rightP) and reqJson.get(rightP)[x] | int >= 4 %}
|
||||
style="background: red;"
|
||||
{% endif %}>
|
||||
{{ rightP }} ({{ ratings[x+5] }})
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user