Beispiel #1
0
def index(request):

	stations_list = Station.objects.all()


	gmap = maps.Map(opts = {
	#(up, left)
        'center': maps.LatLng(-44.7,-72),
        'mapTypeId': maps.MapTypeId.ROADMAP,
        'zoom': 7.5,
        'mapTypeControlOptions': {
             'style': maps.MapTypeControlStyle.DROPDOWN_MENU
	        },
	    })

	for s in stations_list:
		marker = maps.Marker(opts = {
	        	'map': gmap,
       	 		'position': maps.LatLng(s.latitude,s.longitude),
    		})
		info = maps.InfoWindow({
	        	'content': 'Hello!',
        		'disableAutoPan': True
    		})
	    	info.open(gmap, marker)

#	context = {'form': MapForm(initial={'map': gmap})}
	from manualData.charts import Bars
	from manualData.reports import Report
	from manualData.maps import Cinematics

	b = Bars()
	r = Report()
	b_hist=b.get_histogram()
	
	#b_chart = b.get_bars(r.by_month('2010-11'))
	
	b_chart = b.get_bars(r.by_month())


	c =  Cinematics()
	
	cinematics = c.get_cinematics()		
	return render_to_response('index.html', locals() )
Beispiel #2
0
def cinematics(request):
	from statistics.reports import Report
	
	r = Report()
	data = r.all()	
	try:
		year,month = strftime("%Y-%m", gmtime()).split('-')
	except:
		pass

	stations_list = Station.objects.all()
	for s in stations_list:
		p = data[s.name]
		evs = []
		evs1 = []
		evs2 = []
		evs3 = []
		for c in Choice.objects.all():
			evs1.append(len(Evaluation.objects.filter(
                                                        date__year=year,
                                                        date__month=month,
                                                        choice=c,
                                                        station=s
                                                        ))
				  )
			evs2.append(len(Evaluation.objects.filter(
                                                        date__year=year,
                                                        choice=c,
                                                        station=s
                                                        ))
				  )
			evs3.append(len(Evaluation.objects.filter(
                                                        choice=c,
                                                        station=s
                                                        ))
				  )
		evs.append(evs1)
		evs.append(evs2)
		evs.append(evs3)
		data[s.name] =  ([s.latitude,s.longitude],p,evs)
	
	
	gKey = settings.EASY_MAPS_GOOGLE_KEY
	return render_to_response('cinematics.html',locals())