VEH-44: Per Garage CPM Calculations



Issue Information

Issue Type: Improvement
 
Priority: Minor
Status: Open

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: VehMan (VEH)
Resolution: Unresolved
Target version: 1.5,
Components: Charts , Statistics ,

Created: 2013-11-17 06:04:40
Time Spent Working


Description
Generate cost per mile on a per garage basis - allowing for comparison of fuel economy between different garages.

Needs to be carefully implemented though as the metric that needs to be used is the distance between the current and the next fill;

|Garage|Litres|Mileage|PPL|
|Tesco|12|1|£1|
|Shell|10|11|£1.50|
|Texaco|5|21|£1.25|

From the table above we could calculate

|Garage|Economy|CPM|
|Tesco|1 mile per litre|£1|
|Shell|2 miles per litre|75p|
|Texaco| - | - |

i.e. after filling up at Tesco's, a journey of 10 miles required us to put another 10 litres in the tank. The fuel we bought at Tesco's was £1 a litre (I wish) therefore
(10 miles / 10 litres) * £1 = £1 per mile


May be tricky to generate monthly per-garage CPM stats as it's unlikely that all recorded garages will be used each month - an overall stat is probably the better move.


Toggle State Changes

Activity


Might be possible to generate the base statistics at a monthly level though, would make for easier recalculation of the overall statistic.

So in the stats table, we might add

|Year|Month|StatType|Value|Modifier|Description|
|2013|11|GarageFuelBurnt|10|Tesco|In the example above, we had to replace 10 litres of Tesco petrol|
|2013|11|GarageTotalSpend|12|Tesco|In the example above, we bought 12 litres of petrol at £1 from Tesco|
|2013|11|GarageTotalMileage|10|Tesco|In the example above, we travelled 10 miles burning Tesco petrol|

That final statistic will be the most complex to generate, in the sense that we don't want to resort to consistently querying for the next record - it'll put quite a load on the database if we're not careful.

One thing we also need to watch out for (and there's no real way to adjust for it). In the example above, we purchased 12 litres from Tesco, travelled 10 miles and then purchased 10 litres from Shell.

From a stats point of view we then travelled another 10 miles on Shell petrol, before replacing 5 litres of it.

In reality though, at that point we're travelling with a blend of Shell/Tesco petrol (we know from the stats that the tank holds at least 12 litres). This will almost certainly affect fuel economy, but there's no easy way to quantify it from a stats generation point of view.

The best thing we can do is probably to add an FAQ somewhere which explains why you might see a spike/dip in the chart just after changing garages.