From 34555ebb0aa43a747965ef2ef97f3bb068d69870 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Thu, 23 Feb 2012 13:51:10 +0100 Subject: [PATCH] stats revised with columnar display --- chaloBEST/mumbai/views.py | 11 ++++++++--- chaloBEST/templates/stats.html | 33 ++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/chaloBEST/mumbai/views.py b/chaloBEST/mumbai/views.py index ffdb888..61e5c5b 100644 --- a/chaloBEST/mumbai/views.py +++ b/chaloBEST/mumbai/views.py @@ -71,17 +71,22 @@ def stats(request): routes.append(d) areas_sorted = sorted(areas, key=lambda k: k['remaining_stops']) - + routes_sorted = sorted(routes, key=lambda k: k['remaining_stops']) routes = routes_sorted areas = areas_sorted - return render_to_response("stats.html", { + routes.reverse() + areas.reverse() + + context = { 'total_stop_count': total_stops, 'total_stops_left': total_stops_left, 'areas': areas, 'routes': routes - }) + } + #return context + return render_to_response("stats.html", context) diff --git a/chaloBEST/templates/stats.html b/chaloBEST/templates/stats.html index 39e994e..acc5709 100644 --- a/chaloBEST/templates/stats.html +++ b/chaloBEST/templates/stats.html @@ -5,11 +5,11 @@ {% endblock %} {% block head %} - + @@ -45,13 +64,13 @@

ChaloBEST! The Stats..

-

Total Stops : {{ total_stop_count }}
Stops left : {{ total_stops_left }}



+

Total Stops : {{ total_stop_count }}
Stops left : {{ total_stops_left }}

Routes:


-
    +
      {% for r in routes %} -
    • +
    • {{ r.route.alias }} - {{ r.stops_done }} / {{ r.total_stops }}
    • @@ -60,7 +79,7 @@

Areas:


-
    +