feat: make award summary respect mode filter and remove mode from table headers
Summary cards (Total, Confirmed, Worked, Needed) now update based on the selected mode filter. Also removed redundant mode display from table column headers since the mode is already visible in the filter dropdown. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,11 @@
|
||||
// Get available modes from entities
|
||||
$: availableModes = ['Mixed Mode', ...new Set(entities.map(e => e.mode).filter(Boolean).sort())];
|
||||
|
||||
// Filter entities by selected mode for summary calculations
|
||||
$: filteredEntities = selectedMode === 'Mixed Mode'
|
||||
? entities
|
||||
: entities.filter(e => e.mode === selectedMode);
|
||||
|
||||
onMount(async () => {
|
||||
await loadAwardData();
|
||||
});
|
||||
@@ -394,16 +399,16 @@
|
||||
|
||||
<div class="summary">
|
||||
{#if entities.length > 0 && entities[0].points !== undefined}
|
||||
{@const earnedPoints = entities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)}
|
||||
{@const earnedPoints = filteredEntities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)}
|
||||
{@const targetPoints = award.target}
|
||||
{@const neededPoints = Math.max(0, targetPoints - earnedPoints)}
|
||||
<div class="summary-card">
|
||||
<span class="summary-label">Total Combinations:</span>
|
||||
<span class="summary-value">{entities.length}</span>
|
||||
<span class="summary-value">{filteredEntities.length}</span>
|
||||
</div>
|
||||
<div class="summary-card confirmed">
|
||||
<span class="summary-label">Confirmed:</span>
|
||||
<span class="summary-value">{entities.filter((e) => e.confirmed).length}</span>
|
||||
<span class="summary-value">{filteredEntities.filter((e) => e.confirmed).length}</span>
|
||||
</div>
|
||||
<div class="summary-card" style="background-color: #fff3cd; border-color: #ffc107;">
|
||||
<span class="summary-label">Points:</span>
|
||||
@@ -418,12 +423,12 @@
|
||||
<span class="summary-value">{targetPoints}</span>
|
||||
</div>
|
||||
{:else}
|
||||
{@const workedCount = entities.filter((e) => e.worked).length}
|
||||
{@const confirmedCount = entities.filter((e) => e.confirmed).length}
|
||||
{@const neededCount = award.target ? Math.max(0, award.target - workedCount) : entities.filter((e) => !e.worked).length}
|
||||
{@const workedCount = filteredEntities.filter((e) => e.worked).length}
|
||||
{@const confirmedCount = filteredEntities.filter((e) => e.confirmed).length}
|
||||
{@const neededCount = award.target ? Math.max(0, award.target - workedCount) : filteredEntities.filter((e) => !e.worked).length}
|
||||
<div class="summary-card">
|
||||
<span class="summary-label">Total:</span>
|
||||
<span class="summary-value">{entities.length}</span>
|
||||
<span class="summary-value">{filteredEntities.length}</span>
|
||||
</div>
|
||||
<div class="summary-card confirmed">
|
||||
<span class="summary-label">Confirmed:</span>
|
||||
@@ -460,8 +465,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="entity-column">Entity</th>
|
||||
{#each columns as { band, mode }}
|
||||
<th class="band-column">{band}{#if mode} {mode}{/if}</th>
|
||||
{#each columns as { band }}
|
||||
<th class="band-column">{band}</th>
|
||||
{/each}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user