Fix WAS award and improve award progress display
- Fix WAS award filter to use entityId (291) instead of entity string - Fix backend to use normalized rules.target for all award types - Fix frontend to distinguish point-based from entity-based awards - Fix "Needed" calculation for entity awards: target - worked - Remove points display from non-point awards (WAS, DXCC, etc.) - Add proper target field to all award API responses Fixes issue where: - WAS showed 0 states (filter didn't match "UNITED STATES OF AMERICA") - DXCC CW showed "Needed: 0" (target not extracted from nested rules) - Entity awards showed "Points: NaN" (incorrectly detected as point-based) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,9 +13,9 @@
|
|||||||
"operator": "AND",
|
"operator": "AND",
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"field": "entity",
|
"field": "entityId",
|
||||||
"operator": "eq",
|
"operator": "eq",
|
||||||
"value": "United States"
|
"value": 291
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ export async function getAwardEntityBreakdown(userId, awardId) {
|
|||||||
name: award.name,
|
name: award.name,
|
||||||
description: award.description,
|
description: award.description,
|
||||||
caption: award.caption,
|
caption: award.caption,
|
||||||
target: award.rules?.target || 0,
|
target: rules.target || 0,
|
||||||
},
|
},
|
||||||
entities: Array.from(entityMap.values()),
|
entities: Array.from(entityMap.values()),
|
||||||
total: entityMap.size,
|
total: entityMap.size,
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
{#if award && award.target && award.target > 0}
|
{#if entities.length > 0 && entities[0].points !== undefined}
|
||||||
{@const earnedPoints = entities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)}
|
{@const earnedPoints = entities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)}
|
||||||
{@const targetPoints = award.target}
|
{@const targetPoints = award.target}
|
||||||
{@const neededPoints = Math.max(0, targetPoints - earnedPoints)}
|
{@const neededPoints = Math.max(0, targetPoints - earnedPoints)}
|
||||||
@@ -165,21 +165,24 @@
|
|||||||
<span class="summary-value">{targetPoints}</span>
|
<span class="summary-value">{targetPoints}</span>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{: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}
|
||||||
<div class="summary-card">
|
<div class="summary-card">
|
||||||
<span class="summary-label">Total:</span>
|
<span class="summary-label">Total:</span>
|
||||||
<span class="summary-value">{entities.length}</span>
|
<span class="summary-value">{entities.length}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="summary-card confirmed">
|
<div class="summary-card confirmed">
|
||||||
<span class="summary-label">Confirmed:</span>
|
<span class="summary-label">Confirmed:</span>
|
||||||
<span class="summary-value">{entities.filter((e) => e.confirmed).length}</span>
|
<span class="summary-value">{confirmedCount}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="summary-card worked">
|
<div class="summary-card worked">
|
||||||
<span class="summary-label">Worked:</span>
|
<span class="summary-label">Worked:</span>
|
||||||
<span class="summary-value">{entities.filter((e) => e.worked).length}</span>
|
<span class="summary-value">{workedCount}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="summary-card unworked">
|
<div class="summary-card unworked">
|
||||||
<span class="summary-label">Needed:</span>
|
<span class="summary-label">Needed:</span>
|
||||||
<span class="summary-value">{entities.filter((e) => !e.worked).length}</span>
|
<span class="summary-value">{neededCount}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
"operator": "AND",
|
"operator": "AND",
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"field": "entity",
|
"field": "entityId",
|
||||||
"operator": "eq",
|
"operator": "eq",
|
||||||
"value": "United States"
|
"value": 291
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user