stats revised with columnar display

This commit is contained in:
Johnson Chetty 2012-02-23 13:51:10 +01:00
parent 1360bbe4b7
commit 34555ebb0a
2 changed files with 34 additions and 10 deletions

View File

@ -71,17 +71,22 @@ def stats(request):
routes.append(d) routes.append(d)
areas_sorted = sorted(areas, key=lambda k: k['remaining_stops']) areas_sorted = sorted(areas, key=lambda k: k['remaining_stops'])
routes_sorted = sorted(routes, key=lambda k: k['remaining_stops']) routes_sorted = sorted(routes, key=lambda k: k['remaining_stops'])
routes = routes_sorted routes = routes_sorted
areas = areas_sorted areas = areas_sorted
return render_to_response("stats.html", { routes.reverse()
areas.reverse()
context = {
'total_stop_count': total_stops, 'total_stop_count': total_stops,
'total_stops_left': total_stops_left, 'total_stops_left': total_stops_left,
'areas': areas, 'areas': areas,
'routes': routes 'routes': routes
}) }
#return context
return render_to_response("stats.html", context)

View File

@ -5,11 +5,11 @@
{% endblock %} {% endblock %}
{% block head %} {% block head %}
<meta http-equiv="refresh" content="45"> <meta http-equiv="refresh" content="60">
<style type ="text/css"> <style type ="text/css">
body { body {
width: 80%; width: 92%;
margin: 0 auto; margin: 0 auto;
background-color:#ff9900 background-color:#ff9900
} }
@ -29,9 +29,28 @@
.areas { .areas {
color:#000000; color:#000000;
background-color:#00ccff; background-color:#ccff99;
} }
ul{
width:900px;
margin-bottom:20px;
overflow:hidden;
border-top:1px solid #ccc;
}
li{
line-height:1.5em;
/*border-bottom:1px solid #ccc; */
float:left;
display:inline;
}
double li { width:50%;} /* 2 col */
.triple li { width:33.333%; } /* 3 col */
</style> </style>
@ -45,13 +64,13 @@
<h1> ChaloBEST! The Stats.. <h1> ChaloBEST! The Stats..
</h1> </h1>
</div> </div>
<div class="stops"> <h2>Total Stops : {{ total_stop_count }} <br /> Stops left : {{ total_stops_left }}</h2> <br /> <br /> <div class="stops"> <h2>Total Stops : {{ total_stop_count }} <br /> Stops left : {{ total_stops_left }}</h2>
</div> </div>
<div class="routes"> <h3> Routes: </h3><br /> <div class="routes"> <h3> Routes: </h3><br />
<ul id="routesList"> <ul id="routesList" class="triple" >
{% for r in routes %} {% for r in routes %}
<li class="route listItem"> <li class="route listItem" >
<a href="{{r.route.get_absolute_url}}" title="view stops for route"> {{ r.route.alias }} </a> <a href="{{r.route.get_absolute_url}}" title="view stops for route"> {{ r.route.alias }} </a>
- {{ r.stops_done }} / {{ r.total_stops }} - {{ r.stops_done }} / {{ r.total_stops }}
</li> </li>
@ -60,7 +79,7 @@
</div> </div>
<div class="areas"> <h3> Areas: </h3> <br /> <div class="areas"> <h3> Areas: </h3> <br />
<ul id="AreasList"> <ul id="AreasList" class="triple" >
{% for a in areas %} {% for a in areas %}
<li class="area listItem"> <li class="area listItem">
<a href="{{a.area.get_absolute_url}}" title="view stops for area">{{ a.area.name }}</a> - {{ a.stops_done }} / {{ a.total_stops }}. <a href="{{a.area.get_absolute_url}}" title="view stops for area">{{ a.area.name }}</a> - {{ a.stops_done }} / {{ a.total_stops }}.