This commit is contained in:
beo3000 2026-02-08 15:54:35 +01:00
parent 4dbc81bef2
commit 2e3b6f8973
5 changed files with 16 additions and 11 deletions

View File

@ -35,7 +35,8 @@ namespace GoodWood.Application.Games.FoxHunt
ThrowMode = throwMode,
ThrowsPerRound = throwsPerRound,
ParticipantsMode = participantsMode,
LeadingThrows = leadingThrows
LeadingThrows = leadingThrows,
PinCountGoal = pinCountGoal
};
}
}

View File

@ -377,21 +377,22 @@ public class DayService : IDayService
if (club.ExpenseCalculation == ExpenseCalculation.None)
return;
// 3. Get all PersonExpense prices for this day
var dayExpensePrices = await context.PersonExpenses
// 3. Get total expenses per participant for this day
var personExpenseTotals = await context.PersonExpenses
.Where(pe => pe.DayId == dayId && !pe.IsDeleted)
.Select(pe => pe.Price)
.GroupBy(pe => pe.PersonId)
.Select(g => g.Sum(pe => pe.Price))
.ToListAsync(ct);
// 4. Edge case: No expenses - skip
if (dayExpensePrices.Count == 0)
if (personExpenseTotals.Count == 0)
return;
// 5. Calculate price
// 5. Calculate price based on per-person totals
decimal calculatedPrice = club.ExpenseCalculation switch
{
ExpenseCalculation.Average => Math.Round(dayExpensePrices.Average(), 2),
ExpenseCalculation.Maximum => dayExpensePrices.Max(),
ExpenseCalculation.Average => Math.Round(personExpenseTotals.Average(), 2),
ExpenseCalculation.Maximum => personExpenseTotals.Max(),
_ => 0m
};

View File

@ -109,6 +109,7 @@
var setup = new FoxHuntGameSetup
{
LeadingThrows = _options.LeadingThrows,
PinCountGoal = _options.PinCountGoal,
ParticipantsMode = _options.ParticipantsMode
};
await OnOptionsChanged.InvokeAsync(setup);

View File

@ -1,7 +1,7 @@
@using GoodWood.Domain.Enums
<div class="pin @GetPinClass()" @onclick="OnClick" style="@GetStyle()">
<span class="pin-number">@PinNumber</span>
<span class="pin-number"></span>
</div>
<style>

View File

@ -30,13 +30,15 @@
<MudSelect T="int" @bind-Value="_selectedMonth" Label="Monat" Style="width: 150px;">
@for (int m = 1; m <= 12; m++)
{
<MudSelectItem Value="@m">@GetMonthName(m)</MudSelectItem>
var month = m;
<MudSelectItem Value="@month">@GetMonthName(month)</MudSelectItem>
}
</MudSelect>
<MudSelect T="int" @bind-Value="_selectedYear" Label="Jahr" Style="width: 120px;">
@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>
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Refresh"