Services: Extract GenerateToolTipData() from GenerateToolTip()
All checks were successful
Test / Run tests (push) Successful in 1m35s

This commit is contained in:
2024-09-22 20:40:53 +02:00
parent dcec6f03fe
commit 7791d02979
5 changed files with 99 additions and 69 deletions

View File

@ -79,9 +79,9 @@ namespace Elwig.Windows {
if (filter.Count == 0) {
ViewModel.StatusAreaCommitments = $"{await areaComQuery.CountAsync():N0}";
var s = await ctx.Seasons.FindAsync(await ctx.Seasons.MaxAsync(s => s.Year));
var (text, grid) = await AreaComService.GenerateToolTip(areaComQuery, s?.MaxKgPerHa ?? 10_000);
var (text, gridData) = await AreaComService.GenerateToolTipData(areaComQuery, s?.MaxKgPerHa ?? 10_000);
ViewModel.StatusArea = text;
ViewModel.StatusAreaToolTip = grid;
ViewModel.StatusAreaToolTip = AreaComService.GenerateToolTip(gridData);
} else {
ViewModel.StatusAreaCommitments = $"{areaComs.Count:N0}";
ViewModel.StatusArea = $"{areaComs.Select(a => a.Area).Sum():N0} m²";