fix(viewer): normalize mission IDs hash vs underscore + auto-switch USV tab
BUG3b: data-dates API returns hash prefix, missions API returns underscore. Normalize both sides before comparing to properly filter mission fetches. BUG1c: auto-switch to USV tab after sortie data loaded so charts are visible.
This commit is contained in:
@@ -756,8 +756,10 @@ async function loadDate(date) {
|
||||
const knownMissions = dateEntry && dateEntry.missions && dateEntry.missions.length
|
||||
? dateEntry.missions
|
||||
: null;
|
||||
// BUG3b FIX: API data-dates uses #71-golrest but /api/missions uses _71-golrest — normalize for compare
|
||||
const normalize = id => (id || '').replace(/^[#_]/, '').toLowerCase();
|
||||
const missionsToFetch = knownMissions
|
||||
? missions.filter(m => knownMissions.includes(m.id) || knownMissions.some(km => m.id.includes(km) || km.includes(m.id)))
|
||||
? missions.filter(m => knownMissions.some(km => normalize(m.id) === normalize(km)))
|
||||
: missions;
|
||||
|
||||
const fetches = (missionsToFetch.length > 0 ? missionsToFetch : missions).map(async mission => {
|
||||
@@ -1228,6 +1230,7 @@ async function loadSortieData(sortieId) {
|
||||
const usvData = await usvResp.json();
|
||||
renderUSV(usvData.signals);
|
||||
showNoDataOverlay(false); // BUG2 FIX: hide overlay when data loaded
|
||||
switchTab('usv'); // BUG1c FIX: auto-switch to USV tab where charts are rendered
|
||||
}
|
||||
prog.textContent = 'Chargement AUV…';
|
||||
await loadAuvTabs(sortieId);
|
||||
|
||||
Reference in New Issue
Block a user