diff --git a/js/planner.js b/js/planner.js index 717d811..deca3bd 100644 --- a/js/planner.js +++ b/js/planner.js @@ -375,9 +375,11 @@ function aoeEventsToMechanics(aoeEvents, fightStart, phases, players, withMitiga ev.timestamp >= p.startTime && ev.timestamp < p.endTime ); - const targetsWithData = ev.targets.filter(t => (t.unmitigatedAmount ?? 0) > 0); - const avgUnmit = targetsWithData.length > 0 - ? Math.round(targetsWithData.reduce((s, t) => s + t.unmitigatedAmount, 0) / targetsWithData.length) + const nonTankTargets = ev.targets.filter(t => t.role !== 'tank' && (t.unmitigatedAmount ?? 0) > 0); + const fallbackTargets = ev.targets.filter(t => (t.unmitigatedAmount ?? 0) > 0); + const relevantTargets = nonTankTargets.length > 0 ? nonTankTargets : fallbackTargets; + const avgUnmit = relevantTargets.length > 0 + ? Math.round(relevantTargets.reduce((s, t) => s + t.unmitigatedAmount, 0) / relevantTargets.length) : 0; let assignments = []; @@ -465,7 +467,7 @@ function showImportModal(data) { } // Reset to defaults - document.querySelectorAll('input[name="import-what"]').forEach(r => { r.checked = r.value === 'mechanics'; }); + document.querySelectorAll('input[name="import-what"]').forEach(r => { r.checked = r.value === 'with-mitigations'; }); document.querySelectorAll('input[name="import-where"]').forEach(r => { r.checked = r.value === 'new'; }); document.getElementById('import-new-section').style.display = ''; document.getElementById('import-merge-section').style.display = 'none'; diff --git a/templates/page.php b/templates/page.php index d119e8d..1f2eadb 100644 --- a/templates/page.php +++ b/templates/page.php @@ -43,12 +43,12 @@