fixes
This commit is contained in:
parent
4dbc81bef2
commit
2e3b6f8973
|
|
@ -35,7 +35,8 @@ namespace GoodWood.Application.Games.FoxHunt
|
||||||
ThrowMode = throwMode,
|
ThrowMode = throwMode,
|
||||||
ThrowsPerRound = throwsPerRound,
|
ThrowsPerRound = throwsPerRound,
|
||||||
ParticipantsMode = participantsMode,
|
ParticipantsMode = participantsMode,
|
||||||
LeadingThrows = leadingThrows
|
LeadingThrows = leadingThrows,
|
||||||
|
PinCountGoal = pinCountGoal
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,21 +377,22 @@ public class DayService : IDayService
|
||||||
if (club.ExpenseCalculation == ExpenseCalculation.None)
|
if (club.ExpenseCalculation == ExpenseCalculation.None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 3. Get all PersonExpense prices for this day
|
// 3. Get total expenses per participant for this day
|
||||||
var dayExpensePrices = await context.PersonExpenses
|
var personExpenseTotals = await context.PersonExpenses
|
||||||
.Where(pe => pe.DayId == dayId && !pe.IsDeleted)
|
.Where(pe => pe.DayId == dayId && !pe.IsDeleted)
|
||||||
.Select(pe => pe.Price)
|
.GroupBy(pe => pe.PersonId)
|
||||||
|
.Select(g => g.Sum(pe => pe.Price))
|
||||||
.ToListAsync(ct);
|
.ToListAsync(ct);
|
||||||
|
|
||||||
// 4. Edge case: No expenses - skip
|
// 4. Edge case: No expenses - skip
|
||||||
if (dayExpensePrices.Count == 0)
|
if (personExpenseTotals.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 5. Calculate price
|
// 5. Calculate price based on per-person totals
|
||||||
decimal calculatedPrice = club.ExpenseCalculation switch
|
decimal calculatedPrice = club.ExpenseCalculation switch
|
||||||
{
|
{
|
||||||
ExpenseCalculation.Average => Math.Round(dayExpensePrices.Average(), 2),
|
ExpenseCalculation.Average => Math.Round(personExpenseTotals.Average(), 2),
|
||||||
ExpenseCalculation.Maximum => dayExpensePrices.Max(),
|
ExpenseCalculation.Maximum => personExpenseTotals.Max(),
|
||||||
_ => 0m
|
_ => 0m
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@
|
||||||
var setup = new FoxHuntGameSetup
|
var setup = new FoxHuntGameSetup
|
||||||
{
|
{
|
||||||
LeadingThrows = _options.LeadingThrows,
|
LeadingThrows = _options.LeadingThrows,
|
||||||
|
PinCountGoal = _options.PinCountGoal,
|
||||||
ParticipantsMode = _options.ParticipantsMode
|
ParticipantsMode = _options.ParticipantsMode
|
||||||
};
|
};
|
||||||
await OnOptionsChanged.InvokeAsync(setup);
|
await OnOptionsChanged.InvokeAsync(setup);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@using GoodWood.Domain.Enums
|
@using GoodWood.Domain.Enums
|
||||||
|
|
||||||
<div class="pin @GetPinClass()" @onclick="OnClick" style="@GetStyle()">
|
<div class="pin @GetPinClass()" @onclick="OnClick" style="@GetStyle()">
|
||||||
<span class="pin-number">@PinNumber</span>
|
<span class="pin-number"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,15 @@
|
||||||
<MudSelect T="int" @bind-Value="_selectedMonth" Label="Monat" Style="width: 150px;">
|
<MudSelect T="int" @bind-Value="_selectedMonth" Label="Monat" Style="width: 150px;">
|
||||||
@for (int m = 1; m <= 12; m++)
|
@for (int m = 1; m <= 12; m++)
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@m">@GetMonthName(m)</MudSelectItem>
|
var month = m;
|
||||||
|
<MudSelectItem Value="@month">@GetMonthName(month)</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
<MudSelect T="int" @bind-Value="_selectedYear" Label="Jahr" Style="width: 120px;">
|
<MudSelect T="int" @bind-Value="_selectedYear" Label="Jahr" Style="width: 120px;">
|
||||||
@for (int y = DateTime.Today.Year; y >= DateTime.Today.Year - 5; y--)
|
@for (int y = DateTime.Today.Year; y >= DateTime.Today.Year - 5; y--)
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@y">@y</MudSelectItem>
|
var year = y;
|
||||||
|
<MudSelectItem Value="@year">@year</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Refresh"
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Refresh"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue