mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-09 08:28:32 +01:00
some minor improvements
This commit is contained in:
13
server.py
13
server.py
@@ -193,8 +193,16 @@ def balanceTool():
|
|||||||
|
|
||||||
players = []
|
players = []
|
||||||
for k,v in flask.request.json.items():
|
for k,v in flask.request.json.items():
|
||||||
|
for i in range(5):
|
||||||
|
if v[i] in positions:
|
||||||
|
v[i] = 5
|
||||||
|
else:
|
||||||
|
v[i] = int(v[i])
|
||||||
players += [Player(k, v)]
|
players += [Player(k, v)]
|
||||||
|
|
||||||
|
# theoretical minnimum #
|
||||||
|
theoMin = sum([ min(p.prio) for p in players ])
|
||||||
|
|
||||||
permutations = itertools.permutations(players)
|
permutations = itertools.permutations(players)
|
||||||
|
|
||||||
best = 100
|
best = 100
|
||||||
@@ -204,7 +212,7 @@ def balanceTool():
|
|||||||
cur = 0
|
cur = 0
|
||||||
|
|
||||||
for i in range(len(option)):
|
for i in range(len(option)):
|
||||||
cur += int(option[i].prio[i%5])
|
cur += option[i].prio[i%5]
|
||||||
|
|
||||||
if cur < best:
|
if cur < best:
|
||||||
best = cur
|
best = cur
|
||||||
@@ -223,7 +231,8 @@ def balanceTool():
|
|||||||
|
|
||||||
renderContent = flask.render_template("balance_response_partial.html", d=retDict,
|
renderContent = flask.render_template("balance_response_partial.html", d=retDict,
|
||||||
requests=flask.request.json,
|
requests=flask.request.json,
|
||||||
positions=positions)
|
positions=positions,
|
||||||
|
quality=int(theoMin/best*100))
|
||||||
return flask.Response(
|
return flask.Response(
|
||||||
json.dumps({ "content": renderContent }), 200, mimetype='application/json')
|
json.dumps({ "content": renderContent }), 200, mimetype='application/json')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ function parseMultiline(){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const focusEvent = new Event("focus")
|
const inputEvent = new Event("input")
|
||||||
fastPosFields.forEach(el => el.dispatchEvent(focusEvent))
|
fastPosFields.forEach(el => el.dispatchEvent(inputEvent))
|
||||||
balance()
|
balance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
<div class="my-3">
|
||||||
|
<h3> Suggestion: (Quality: {{ quality }}%)</h3>
|
||||||
|
</div>
|
||||||
{% for x in range(5) %}
|
{% for x in range(5) %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% set leftP = d["left"][positions[x]] %}
|
{% set leftP = d["left"][positions[x]] %}
|
||||||
|
|||||||
@@ -17,13 +17,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="mb-3 btn btn-secondary" onclick="balance()">Go</button>
|
<button type="button" class="mb-3 btn btn-secondary" onclick="balance()">Find Teams</button>
|
||||||
<button type="button" class="mb-3 btn btn-secondary" onclick="queryForPlayerData()">
|
</br>
|
||||||
Check Submissions
|
|
||||||
</button></br>
|
|
||||||
<button id="copyLink" type="button" class="mb-3 btn btn-secondary" onclick="copy()">
|
<button id="copyLink" type="button" class="mb-3 btn btn-secondary" onclick="copy()">
|
||||||
Copy Submission Link
|
Copy Submission Link
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="mb-3 btn btn-secondary" onclick="queryForPlayerData()">
|
||||||
|
Check Submissions
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="spinner-border" id="loading" style="display: none;" role="status">
|
<div class="spinner-border" id="loading" style="display: none;" role="status">
|
||||||
<span class="sr-only">Loading...</span>
|
<span class="sr-only">Loading...</span>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<!-- fast postition slection field -->
|
<!-- fast postition slection field -->
|
||||||
<input class="form-control fastpos m-3" type="text"
|
<input class="form-control fastpos m-3" type="text"
|
||||||
placeholder="top > mid = bot"
|
placeholder="Fast Position Input"
|
||||||
id="fastpos-submission">
|
id="fastpos-submission">
|
||||||
|
|
||||||
<div class="col-sm m-3" style="min-width: 300px;">
|
<div class="col-sm m-3" style="min-width: 300px;">
|
||||||
@@ -44,6 +44,23 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
|
|
||||||
|
<div class="mt-5">
|
||||||
|
<h4>Priorität</h4>
|
||||||
|
<p>
|
||||||
|
1 = höchste </br>
|
||||||
|
5 = niedrigste </br>
|
||||||
|
</p>
|
||||||
|
<hr class="my-3">
|
||||||
|
<h4>Fast-Position</h4>
|
||||||
|
<p>
|
||||||
|
<b>Positionen können in den Kurzschreibweisen: top, mid, bot, jungle, support mit "=" und ">" angegeben werden. Zum Beispiel:</b></br></br>
|
||||||
|
top > mid > top = adc</br>
|
||||||
|
mid = top > bot</br>
|
||||||
|
support > jungle</br>
|
||||||
|
etc..</br>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user