Add filtering
Improve matching
This commit is contained in:
@@ -23,30 +23,17 @@ namespace MileageTraker.Web.Controllers
|
||||
// default parameter processing
|
||||
if (!query.HasParameters())
|
||||
{
|
||||
query.Year = validLogYearMonths.First().Year;
|
||||
query.FiscalYear = validLogYearMonths.First().Year;
|
||||
query.Month = validLogYearMonths.First().Month;
|
||||
}
|
||||
if (query.Year.HasValue && !query.Month.HasValue)
|
||||
{
|
||||
var validLogMonths = validLogYearMonths.Where(dt => dt.Year == query.Year).ToList();
|
||||
query.Month = validLogMonths.Min(dt => dt.Month);
|
||||
}
|
||||
|
||||
var fuelLogs = DataService.GetFuelLogs();
|
||||
|
||||
//fuelLogs.OrderBy(f => f.FuelLogId);
|
||||
var flvm = from fl in DataService.FilterFuelLogs(fuelLogs, query).ToList()
|
||||
orderby fl.Date ascending
|
||||
select new FuelLogIndexViewModel(fl);
|
||||
|
||||
//var filteredLogs =
|
||||
// (from log in DataService.GetFuelLogIndexViewModels(DataService.FilterLogs(fuelLogs, query))
|
||||
// orderby log. descending
|
||||
// select log).ToList();
|
||||
|
||||
var flvm = from fl in fuelLogs.ToList()
|
||||
select new FuelLogIndexViewModel(fl);
|
||||
|
||||
var viewModel = new ResultsViewModel(flvm, query, CustomExtensions.YearMonthList(validLogYearMonths));
|
||||
|
||||
//Session.Add("FuelLogPage", Request.Url.PathAndQuery);
|
||||
var viewModel = new FuelLogResultsViewModel(flvm, query, CustomExtensions.YearMonthList(validLogYearMonths));
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
@@ -173,7 +160,7 @@ namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
Status = MatchStatus.NoMatch.ToString(),
|
||||
Message = "Already matched to log",
|
||||
Action = RenderRazorViewToString("ImportMatchLogView", fuelLog.Log.LogId)
|
||||
Action = RenderRazorViewToString("MatchLink", new MatchLinkViewModel(fuelLog))
|
||||
|
||||
}, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
@@ -185,7 +172,8 @@ namespace MileageTraker.Web.Controllers
|
||||
return Json(new
|
||||
{
|
||||
Status = MatchStatus.NoMatch.ToString(),
|
||||
Message = "Unable to find match"
|
||||
Message = "Unable to find match",
|
||||
Action = RenderRazorViewToString("MatchLink", new MatchLinkViewModel(fuelLog))
|
||||
}, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
fuelLog.Log = matchingLog;
|
||||
@@ -193,7 +181,7 @@ namespace MileageTraker.Web.Controllers
|
||||
return Json(new
|
||||
{
|
||||
Status = MatchStatus.Match.ToString(),
|
||||
Action = RenderRazorViewToString("ImportMatchedLog", new ImportMatchedLogViewModel { LogId = fuelLog.Log.LogId })
|
||||
Action = RenderRazorViewToString("MatchLink", new MatchLinkViewModel(fuelLog))
|
||||
}, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user