Commit 3d076aba authored by Praibait's avatar Praibait
Browse files

Fix bugs stats_pot

parent bee24896
...@@ -339,14 +339,17 @@ def toggle_transaction(request): ...@@ -339,14 +339,17 @@ def toggle_transaction(request):
def stats_pot(request, idpot = None): def stats_pot(request, idpot = None):
if (request.method == "GET") or (request.session.get("logged", None) != "ok"): if (request.method == "GET") or (request.session.get("logged", None) != "ok"):
return HttpResponse("Get the fuck out of here", status=44) return HttpResponse("Get the fuck out of here", status=444)
else: else:
success, sock_ou_response = nk.socket_still_alive(request) success, sock_ou_response = nk.socket_still_alive(request)
if success: if success:
sock = sock_ou_response sock = sock_ou_response
sock.write(json.dumps(["stats_entree_pot", idpot])) sock.write(json.dumps(["stats_entree_pot", idpot]))
out = nk.full_read(sock)["msg"] out = nk.full_read(sock)["msg"]
out = [ [l[0], l[1]] for l in out] if out:
return HttpResponse(json.dumps(out)) out = [ [l[0], l[1]] for l in out]
return HttpResponse(json.dumps(out))
else:
return HttpResponse(u'"Bad request"', status=400)
else: else:
return HttpResponse(u'"Erreur"') return HttpResponse(u'"Erreur"')
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
<h3>Graphiques d'entrées</h3> <h3>Graphiques d'entrées</h3>
{% endif %} {% endif %}
<select id="selecteur"> <select id="selecteur">
<option value=-1 selected></option> <option value=1790 selected>1790</option>
<option value=1790>1790</option>
<option value=1754>1754</option> <option value=1754>1754</option>
<select/> <select/>
<div id="container" style="width:50%; height:400px;"></div> <div id="container" style="width:50%; height:400px;"></div>
...@@ -101,6 +100,8 @@ function change_pot() { ...@@ -101,6 +100,8 @@ function change_pot() {
} }
change_pot();
function affiche_stats(liste) { function affiche_stats(liste) {
var max = liste[liste.length-1][1]; var max = liste[liste.length-1][1];
$(function () { $(function () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment