def carbonSummaryAllTrips(): fromTs = request.query.from_ts toTs = request.query.to_ts logging.debug("Filtering values for range %s -> %s" % (fromTs, toTs)) return carbon.getSummaryAllTrips( datetime.fromtimestamp(float(fromTs) / 1000), datetime.fromtimestamp(float(toTs) / 1000))
def carbonSummaryAllTrips(): fromTs = request.query.from_ts toTs = request.query.to_ts logging.debug("Filtering values for range %s -> %s" % (fromTs, toTs)) return carbon.getSummaryAllTrips( datetime.fromtimestamp(float(fromTs) / 1000), datetime.fromtimestamp(float(toTs) / 1000) )
def testSummaryAllTrips(self): summary = carbon.getSummaryAllTrips(self.weekago, self.now) # *2 because the walking trips don't count, but we have doubled the bus # trips to count as air trips self.assertEqual(summary['current'], (self.busCarbon * self.busExpect + self.airCarbon * self.busExpect)/1000) # No * 2 because the optimal value for short bus trips is to actually move to bikes :) self.assertEqual(summary['optimal'], (self.busOptimalCarbon * self.busExpect)/1000) # These are are without air, so will only count the bus trips self.assertEqual(summary['current no air'], (self.busCarbon * self.busExpect)/1000) self.assertEqual(summary['optimal no air'], 0) self.assertAlmostEqual(summary['all drive'], (self.driveCarbon * (self.busExpect * 2 + self.walkExpect))/1000, places = 4)
def testSummaryAllTrips(self): summary = carbon.getSummaryAllTrips(self.weekago, self.now) # *2 because the walking trips don't count, but we have doubled the bus # trips to count as air trips self.assertEqual(summary['current'], (self.busCarbon * self.busExpect + self.airCarbon * self.busExpect) / 1000) # No * 2 because the optimal value for short bus trips is to actually move to bikes :) self.assertEqual(summary['optimal'], (self.busOptimalCarbon * self.busExpect) / 1000) # These are are without air, so will only count the bus trips self.assertEqual(summary['current no air'], (self.busCarbon * self.busExpect) / 1000) self.assertEqual(summary['optimal no air'], 0) self.assertAlmostEqual(summary['all drive'], (self.driveCarbon * (self.busExpect * 2 + self.walkExpect)) / 1000, places=4)