Skip to content

Commit bb8701b

Browse files
kaankaraogluclaude
andauthored
rename: Highest DPS → Highest Damage Done (#179)
* rename: Highest DPS → Highest Damage Done Rename biggestHit to highestDamageDone across UI label, data property, composable, fetch script, and tests. Also fix test that checked for a non-existent ability field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: skip data tests when fetched JSON files are missing Since PR #178 gitignored wcl-stats.json and rio-mythicplus.json, these tests fail in CI or local environments without API credentials. Use describe.skipIf to gracefully skip when files don't exist, and read via fs instead of import to avoid Vite resolve errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Kaan Karaoglu <9263013+kaankaraoglu@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f9d38c5 commit bb8701b

5 files changed

Lines changed: 69 additions & 38 deletions

File tree

scripts/fetch-wcl-stats.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Writes to src/data/wcl-stats.json with:
55
* - Most Deaths: player with the highest total deaths across all reports
66
* - Iron Raider: player who attended the most kills without ever dying
7-
* - Biggest Hit: highest single-report damage total by any one player
7+
* - Highest Damage Done: highest single-report damage total by any one player
88
*
99
* Requires WCL_CLIENT_ID and WCL_CLIENT_SECRET env vars.
1010
* Usage: node scripts/fetch-wcl-stats.js
@@ -30,7 +30,7 @@ const EMPTY_OUTPUT = {
3030
stats: {
3131
mostDeaths: null,
3232
ironRaider: null,
33-
biggestHit: null,
33+
highestDamageDone: null,
3434
bestHealer: null,
3535
},
3636
}
@@ -249,7 +249,7 @@ async function fetchStats(token) {
249249
const killAttendanceByName = new Map()
250250

251251
/** @type {{ name: string, type: string, total: number, reportCode: string, bossName: string } | null} */
252-
let biggestHitEntry = null
252+
let highestDamageDoneEntry = null
253253

254254
/** @type {{ name: string, type: string, total: number, reportCode: string, bossName: string } | null} */
255255
let bestHealerEntry = null
@@ -280,7 +280,7 @@ async function fetchStats(token) {
280280
}
281281
}
282282

283-
// Track biggest hit and best healer — query per individual boss fight
283+
// Track highest damage done and best healer — query per individual boss fight
284284
// so we get highest single-fight values, not summed across all fights
285285
for (const fight of bossFights) {
286286
const [fightDamage, fightHealing] = await Promise.all([
@@ -291,8 +291,8 @@ async function fetchStats(token) {
291291
for (const entry of fightDamage) {
292292
const total = entry.total ?? entry.amount ?? 0
293293
if (!entry.name || total === 0) continue
294-
if (!biggestHitEntry || total > biggestHitEntry.total) {
295-
biggestHitEntry = {
294+
if (!highestDamageDoneEntry || total > highestDamageDoneEntry.total) {
295+
highestDamageDoneEntry = {
296296
name: entry.name,
297297
type: entry.type || '',
298298
total,
@@ -369,15 +369,16 @@ async function fetchStats(token) {
369369
}
370370
}
371371

372-
// --- Biggest Hit ---
373-
let biggestHit = null
374-
if (biggestHitEntry) {
375-
biggestHit = {
376-
name: biggestHitEntry.name,
377-
class: CLASS_MAP[biggestHitEntry.type] || biggestHitEntry.type.toLowerCase() || null,
378-
amount: biggestHitEntry.total,
379-
boss: biggestHitEntry.bossName || null,
380-
report: `https://www.warcraftlogs.com/reports/${biggestHitEntry.reportCode}`,
372+
// --- Highest Damage Done ---
373+
let highestDamageDone = null
374+
if (highestDamageDoneEntry) {
375+
highestDamageDone = {
376+
name: highestDamageDoneEntry.name,
377+
class:
378+
CLASS_MAP[highestDamageDoneEntry.type] || highestDamageDoneEntry.type.toLowerCase() || null,
379+
amount: highestDamageDoneEntry.total,
380+
boss: highestDamageDoneEntry.bossName || null,
381+
report: `https://www.warcraftlogs.com/reports/${highestDamageDoneEntry.reportCode}`,
381382
}
382383
}
383384

@@ -398,7 +399,7 @@ async function fetchStats(token) {
398399
stats: {
399400
mostDeaths,
400401
ironRaider,
401-
biggestHit,
402+
highestDamageDone,
402403
bestHealer,
403404
},
404405
}
@@ -418,7 +419,7 @@ async function main() {
418419
console.log(
419420
`[wcl-stats] Wrote stats: mostDeaths=${data.stats.mostDeaths?.name ?? 'none'}, ` +
420421
`ironRaider=${data.stats.ironRaider?.name ?? 'none'}, ` +
421-
`biggestHit=${data.stats.biggestHit?.name ?? 'none'}, ` +
422+
`highestDamageDone=${data.stats.highestDamageDone?.name ?? 'none'}, ` +
422423
`bestHealer=${data.stats.bestHealer?.name ?? 'none'}`,
423424
)
424425
} catch (err) {

src/components/RaidStatsBox.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@
3636
<p v-else class="stat-empty">No data yet.</p>
3737
</div>
3838
<div class="info-box info-box--no-hover stat-card">
39-
<p class="stat-label">Highest DPS</p>
40-
<template v-if="stats.biggestHit">
41-
<p :class="['stat-name', stats.biggestHit.class]">{{ stats.biggestHit.name }}</p>
39+
<p class="stat-label">Highest Damage Done</p>
40+
<template v-if="stats.highestDamageDone">
41+
<p :class="['stat-name', stats.highestDamageDone.class]">
42+
{{ stats.highestDamageDone.name }}
43+
</p>
4244
<p class="stat-value">
43-
{{ formatNumber(stats.biggestHit.amount) }} on {{ stats.biggestHit.boss || 'a boss' }}
45+
{{ formatNumber(stats.highestDamageDone.amount) }} on
46+
{{ stats.highestDamageDone.boss || 'a boss' }}
4447
</p>
4548
<a
46-
v-if="stats.biggestHit.report"
49+
v-if="stats.highestDamageDone.report"
4750
class="stat-link"
48-
:href="stats.biggestHit.report"
51+
:href="stats.highestDamageDone.report"
4952
target="_blank"
5053
rel="noopener noreferrer"
5154
>View Log</a

src/composables/useRaidStats.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ import statsData from '@/data/wcl-stats.json'
33
/**
44
* @typedef {{ name: string, class: string, count: number }} DeathStat
55
* @typedef {{ name: string, class: string, killsAttended: number }} IronRaiderStat
6-
* @typedef {{ name: string, class: string, amount: number, ability: string, boss: string, report?: string }} BiggestHitStat
6+
* @typedef {{ name: string, class: string, amount: number, boss: string, report?: string }} HighestDamageDoneStat
77
* @typedef {{ name: string, class: string, amount: number, boss: string, report?: string }} BestHealerStat
8-
* @typedef {{ mostDeaths: DeathStat|null, ironRaider: IronRaiderStat|null, biggestHit: BiggestHitStat|null, bestHealer: BestHealerStat|null }} RaidStats
8+
* @typedef {{ mostDeaths: DeathStat|null, ironRaider: IronRaiderStat|null, highestDamageDone: HighestDamageDoneStat|null, bestHealer: BestHealerStat|null }} RaidStats
99
*/
1010

1111
export function useRaidStats() {
1212
const stats = statsData.stats
13-
const hasData = !!(stats.mostDeaths || stats.ironRaider || stats.biggestHit || stats.bestHealer)
13+
const hasData = !!(
14+
stats.mostDeaths ||
15+
stats.ironRaider ||
16+
stats.highestDamageDone ||
17+
stats.bestHealer
18+
)
1419

1520
return {
1621
zone: statsData.zone,

src/data/__tests__/mythicplus.spec.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
import { describe, it, expect } from 'vitest'
2-
import data from '../rio-mythicplus.json'
1+
import { describe, it, expect, beforeAll } from 'vitest'
2+
import { existsSync, readFileSync } from 'fs'
3+
import { dirname, resolve } from 'path'
4+
import { fileURLToPath } from 'url'
5+
6+
const jsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'rio-mythicplus.json')
7+
const exists = existsSync(jsonPath)
8+
9+
describe.skipIf(!exists)('M+ data', () => {
10+
/** @type {any} */
11+
let data
12+
beforeAll(() => {
13+
data = JSON.parse(readFileSync(jsonPath, 'utf-8'))
14+
})
315

4-
describe('M+ data', () => {
516
it('has required top-level fields', () => {
617
expect(data).toHaveProperty('season')
718
expect(data).toHaveProperty('topRunners')
Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
import { describe, it, expect } from 'vitest'
2-
import data from '../wcl-stats.json'
1+
import { describe, it, expect, beforeAll } from 'vitest'
2+
import { existsSync, readFileSync } from 'fs'
3+
import { dirname, resolve } from 'path'
4+
import { fileURLToPath } from 'url'
5+
6+
const jsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'wcl-stats.json')
7+
const exists = existsSync(jsonPath)
8+
9+
describe.skipIf(!exists)('WCL stats data', () => {
10+
/** @type {any} */
11+
let data
12+
beforeAll(() => {
13+
data = JSON.parse(readFileSync(jsonPath, 'utf-8'))
14+
})
315

4-
describe('WCL stats data', () => {
516
it('has required top-level fields', () => {
617
expect(data).toHaveProperty('zone')
718
expect(data).toHaveProperty('stats')
819
expect(data.stats).toHaveProperty('mostDeaths')
920
expect(data.stats).toHaveProperty('ironRaider')
10-
expect(data.stats).toHaveProperty('biggestHit')
21+
expect(data.stats).toHaveProperty('highestDamageDone')
1122
})
1223

1324
it('mostDeaths has name, class, and count when present', () => {
@@ -18,11 +29,11 @@ describe('WCL stats data', () => {
1829
}
1930
})
2031

21-
it('biggestHit has name, class, amount, ability, and boss when present', () => {
22-
if (data.stats.biggestHit) {
23-
expect(data.stats.biggestHit).toHaveProperty('name')
24-
expect(data.stats.biggestHit).toHaveProperty('amount')
25-
expect(data.stats.biggestHit).toHaveProperty('ability')
32+
it('highestDamageDone has name, class, amount, and boss when present', () => {
33+
if (data.stats.highestDamageDone) {
34+
expect(data.stats.highestDamageDone).toHaveProperty('name')
35+
expect(data.stats.highestDamageDone).toHaveProperty('amount')
36+
expect(data.stats.highestDamageDone).toHaveProperty('boss')
2637
}
2738
})
2839
})

0 commit comments

Comments
 (0)