def post(self):

		has_construction = self.request.get("has_construction")
		computed_weight = None

		if has_construction == "true":
			computed_weight = 5
		else:
			computed_weight = 3

		new_location = TrafficReport(
			latitude = float(self.request.get("latitude")),
			longitude = float(self.request.get("longitude")),
			report_date = datetime.now(),
			weight = computed_weight)
		new_location.put()
		self.response.out.write("Your post has been processed. You will now be redirected.")
	def get(self):
		reports = TrafficReport.query().fetch()
		result = '{"reports":['

		for r in reports:
			
			age = ((datetime.now() - r.report_date).seconds / 600)
			if age == 0:
				age = 1
			computed_weight = r.weight / age

			result += "{" + "\"latitude\": {0}, \"longitude\": {1}, \"report_date\": \"{2}\", \"weight\": {3}".format(r.latitude, r.longitude, r.report_date.strftime("%d.%m.%Y %H:%M"), computed_weight) + "},"

		result += ']}'

		self.response.out.write(result.replace("},]", "}]"))