Update existing reports, removing mileage drill down

This commit is contained in:
2015-10-23 12:13:09 -04:00
parent 25fb070701
commit 7933632cfb
8 changed files with 98 additions and 61 deletions
+4 -16
View File
@@ -169,10 +169,6 @@ namespace MileageTraker.Web.DAL
let miles = g.Sum(l => l.miles)
let gasPurchased = g.Sum(l => l.log.GasPurchased)
where miles > 0 || gasPurchased > 0
let logPairs =
from i in g
orderby i.log.Date descending , i.log.EndOdometer descending
select new { PreviousLog = i.previousLog, Log = i.log }
select
new
{
@@ -180,7 +176,7 @@ namespace MileageTraker.Web.DAL
GasPurchased = gasPurchased,
Miles = miles,
g.Key.Prog,
LogPairs = logPairs
TripCount = g.Count()
};
return items.ToList().Select(i => new VehicleMileageItem
@@ -189,8 +185,7 @@ namespace MileageTraker.Web.DAL
GasPurchased = i.GasPurchased,
Miles = i.Miles,
Prog = i.Prog,
LogPairs = i.LogPairs.ToList()
.Select(lp => new Tuple<Log,Log>(lp.PreviousLog, lp.Log))
TripCount = i.TripCount
});
}
@@ -206,23 +201,17 @@ namespace MileageTraker.Web.DAL
from i in g
group i by i.log.Vehicle into v
let vehicle = v.Key
//from vehicle in _db.Vehicles
//where vehicle.VehicleId == v.Key.VehicleId
let vehicleProg = vehicle.Prog
let vehicleMiles = v.Sum(l => l.miles)
let vehicleGasPurchased = v.Sum(l => l.log.GasPurchased)
where vehicleMiles > 0 || vehicleGasPurchased > 0
let vehicleLogPairs =
from i in v
orderby i.log.Date descending, i.log.EndOdometer descending
select new { PreviousLog = i.previousLog, Log = i.log }
select new
{
v.Key.VehicleId,
Prog = vehicleProg,
Miles = vehicleMiles,
GasPurchased = vehicleGasPurchased,
LogPairs = vehicleLogPairs
TripCount = v.Count()
}
select
new
@@ -240,8 +229,7 @@ namespace MileageTraker.Web.DAL
Prog = v.Prog,
Miles = v.Miles,
GasPurchased = v.GasPurchased,
LogPairs = v.LogPairs.ToList()
.Select(lp => new Tuple<Log, Log>(lp.PreviousLog, lp.Log))
TripCount = v.TripCount
}).ToList()
});
}