fix: export preview missing athleteName and timeSlot data
- JOIN martial_athlete table to get player names - Calculate timeSlot from time_slot_index (0=08:30, 1=13:30, 2=18:30) - Use COALESCE to fallback to athlete table when participant name is null Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
+15
-2
@@ -16,7 +16,18 @@
|
|||||||
d.id AS detailId,
|
d.id AS detailId,
|
||||||
d.venue_id AS venueId,
|
d.venue_id AS venueId,
|
||||||
d.venue_name AS venueName,
|
d.venue_name AS venueName,
|
||||||
d.time_slot AS timeSlot,
|
COALESCE(NULLIF(d.time_slot, ''),
|
||||||
|
CASE
|
||||||
|
WHEN d.time_slot_index IS NOT NULL THEN
|
||||||
|
CASE d.time_slot_index % 3
|
||||||
|
WHEN 0 THEN '08:30'
|
||||||
|
WHEN 1 THEN '13:30'
|
||||||
|
WHEN 2 THEN '18:30'
|
||||||
|
ELSE '08:30'
|
||||||
|
END
|
||||||
|
ELSE ''
|
||||||
|
END
|
||||||
|
) AS timeSlot,
|
||||||
d.time_slot_index AS timeSlotIndex,
|
d.time_slot_index AS timeSlotIndex,
|
||||||
d.schedule_date AS scheduleDate,
|
d.schedule_date AS scheduleDate,
|
||||||
p.participant_id AS participantId,
|
p.participant_id AS participantId,
|
||||||
@@ -24,13 +35,15 @@
|
|||||||
p.check_in_status AS checkInStatus,
|
p.check_in_status AS checkInStatus,
|
||||||
p.schedule_status AS scheduleStatus,
|
p.schedule_status AS scheduleStatus,
|
||||||
p.performance_order AS performanceOrder,
|
p.performance_order AS performanceOrder,
|
||||||
p.player_name AS playerName
|
COALESCE(p.player_name, ma.player_name) AS playerName
|
||||||
FROM
|
FROM
|
||||||
martial_schedule_group g
|
martial_schedule_group g
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
martial_schedule_detail d ON g.id = d.schedule_group_id AND d.is_deleted = 0
|
martial_schedule_detail d ON g.id = d.schedule_group_id AND d.is_deleted = 0
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
martial_schedule_participant p ON g.id = p.schedule_group_id AND p.is_deleted = 0
|
martial_schedule_participant p ON g.id = p.schedule_group_id AND p.is_deleted = 0
|
||||||
|
LEFT JOIN
|
||||||
|
martial_athlete ma ON p.participant_id = ma.id AND ma.is_deleted = 0
|
||||||
WHERE
|
WHERE
|
||||||
g.competition_id = #{competitionId}
|
g.competition_id = #{competitionId}
|
||||||
AND g.is_deleted = 0
|
AND g.is_deleted = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user