stats revised..

This commit is contained in:
Johnson Chetty 2012-02-23 12:56:08 +01:00
commit 1360bbe4b7
2 changed files with 1 additions and 41 deletions

View File

@ -23,7 +23,7 @@ a:hover {
<ul id="stopList">
{% for r in routeDetails %}
<li>
<a href="{{ r.stop.get_absolute_url }}" class="{% if r.stop.point %} has_point {% else %} no_point {% endif %}">{{ r.stop.name }}</a>
<a href="{{ r.stop.get_absolute_url }}" class="{% if r.stop.point %} has_point {% else %} no_point {% endif %}">{{ r.stop.name }}</a> - {{ r.stop.dbdirection }}
</li>
{% endfor %}

View File

@ -11,43 +11,3 @@ def index(request):
return render_to_response('index.html', {} )
def stats(request):
#No. of stops left
total_stops = Stop.objects.count()
stops_left = total_stops
for stp in Stop.objects.all():
if stp.point:
stops_left-=1
#list of of areas having stops left
arealist = Area.objects.all()
area_stat = []
for area in arealist:
# area_stops = area.stop_set.all()
# astops_left = len(area_stops)
astops_left = Stop.objects.filter(area=area).filter(point=None).count()
# for stp in area_stops:
# if stp.point:
# astops_left-=1
#
area_stat.append({'area':area,'neededstops':astops_left})
#Routes having min stops left...
route_stats_temp = getRoutesHavingSomeLocs(5)
route_stat = []
for routedict in route_stats_temp:
if routedict['neededstops']:
route_stat.append(routedict)
ret = {}
ret['area_stat'] = area_stat
ret['route_stat'] = route_stat
ret['stops_left'] = stops_left
#return ret
return render_to_response('stats.html', ret)