fix: use qsoId for fetching QSO details in award page modal

The award page was filtering QSOs by callsign/date/band/mode, which
could return the wrong QSO when multiple QSOs with the same callsign
exist on the same band/mode combination.

Changes:
- Backend: Add qsoId field to award entity breakdown responses
- Backend: Add GET /api/qsos/:id endpoint to fetch QSO by ID
- Backend: Implement getQSOById() function in lotw.service.js
- Frontend: Update openQSODetailModal() to fetch by qsoId instead of filtering
- Frontend: Include qsoId in QSO entry objects for modal click handler

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 13:08:19 +01:00
parent b332989844
commit 9dc8c8b678
4 changed files with 68 additions and 12 deletions

View File

@@ -210,6 +210,7 @@ async function calculateDOKAwardProgress(userId, award, options = {}) {
// Initialize combination if not exists
if (!dokCombinations.has(combinationKey)) {
dokCombinations.set(combinationKey, {
qsoId: qso.id,
entity: dok,
entityId: null,
entityName: dok,
@@ -335,6 +336,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
if (!combinationMap.has(combinationKey)) {
combinationMap.set(combinationKey, {
qsoId: qso.id,
callsign,
band,
mode,
@@ -373,6 +375,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
if (!stationMap.has(callsign)) {
stationMap.set(callsign, {
qsoId: qso.id,
callsign,
points,
worked: true,
@@ -410,6 +413,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
if (qso.lotwQslRstatus === 'Y') {
totalPoints += points;
stationDetails.push({
qsoId: qso.id,
callsign,
points,
worked: true,
@@ -446,6 +450,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
const entities = stationDetails.map((detail) => {
if (countMode === 'perBandMode') {
return {
qsoId: detail.qsoId,
entity: `${detail.callsign}/${detail.band}/${detail.mode}`,
entityId: null,
entityName: `${detail.callsign} (${detail.band}/${detail.mode})`,
@@ -460,6 +465,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
};
} else if (countMode === 'perStation') {
return {
qsoId: detail.qsoId,
entity: detail.callsign,
entityId: null,
entityName: detail.callsign,
@@ -474,6 +480,7 @@ async function calculatePointsAwardProgress(userId, award, options = {}) {
};
} else {
return {
qsoId: detail.qsoId,
entity: `${detail.callsign}-${detail.qsoDate}`,
entityId: null,
entityName: `${detail.callsign} on ${detail.qsoDate}`,
@@ -673,6 +680,7 @@ export async function getAwardEntityBreakdown(userId, awardId) {
}
entityMap.set(entity, {
qsoId: qso.id,
entity,
entityId: qso.entityId,
entityName: displayName,