Skip to content

Commit

Permalink
handle reports with no fights / zone
Browse files Browse the repository at this point in the history
  • Loading branch information
emallson committed Apr 21, 2024
1 parent 2177e6d commit 2ebf34d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/route/wcl/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ interface FightData {
enemyNPCs?: Enemy[];
}
>;
phases: Array<{
phases?: Array<{
boss: number;
separatesWipes: boolean;
phases: Array<{
Expand Down Expand Up @@ -256,14 +256,15 @@ function reportDataCompat({ reportData: { report } }: FightData): WCLReport {
return fight;
},
),
phases: report.phases.map(({ boss, phases, separatesWipes }) => ({
boss,
phases: phases.map(({ name }) => name),
intermissions: phases
.filter(({ isIntermission }) => isIntermission)
.map(({ id }) => id),
separatesWipes,
})),
phases:
report.phases?.map(({ boss, phases, separatesWipes }) => ({
boss,
phases: phases.map(({ name }) => name),
intermissions: phases
.filter(({ isIntermission }) => isIntermission)
.map(({ id }) => id),
separatesWipes,
})) ?? [],
owner: report.owner.name,
lang: report.masterData.lang,
logVersion: report.masterData.logVersion,
Expand All @@ -280,7 +281,7 @@ function reportDataCompat({ reportData: { report } }: FightData): WCLReport {
enemies: withFights(report, "enemyNPCs", mapEnemy),
friendlyPets: withFights(report, "friendlyPets", mapPet),
enemyPets: withFights(report, "enemyPets", mapEnemy),
zone: report.zone.id,
zone: report.zone?.id ?? 0,
exportedCharacters: report.exportedCharacters?.map(
({ server, ...rest }) => ({
...rest,
Expand Down

0 comments on commit 2ebf34d

Please sign in to comment.