Skip to content

Commit

Permalink
Fix off-by-one error in portrait display on collections page and chos…
Browse files Browse the repository at this point in the history
…e-avatar modal
  • Loading branch information
ChriZiegler committed Sep 8, 2023
1 parent 5215eef commit 7bc312d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ChooseAvatarModalComponent implements OnInit {
ngOnInit() {
this.userService.getDiscoveries().subscribe(({ discoveries }: any) => {
const portraits = discoveries.portraits || {};
this.selectablePortraits = Object.keys(portraits).map((x) => +x);
this.selectablePortraits = Object.keys(portraits).map((x) => +x + 1);
});

this.selectedPortrait = this.defaultPortrait + 1;
Expand Down
6 changes: 4 additions & 2 deletions client/src/app/pages/collections/collections.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@
class="collect-col"
*ngFor="let portrait of allPortraits; trackBy: trackBy"
>
<ion-avatar [class.uncollected]="!discoveries.portraits?.[portrait]">
<ion-avatar
[class.uncollected]="!discoveries.portraits?.[portrait - 1]"
>
<app-icon spritesheet="portraits" [sprite]="portrait"></app-icon>
</ion-avatar>
</ion-col>
Expand Down Expand Up @@ -553,7 +555,7 @@
*ngFor="let background of allBackgrounds; trackBy: trackBy"
>
<app-background-art
[class.uncollected]="!discoveries.backgrounds?.[background]"
[class.uncollected]="!discoveries.backgrounds?.[background - 1]"
[sprite]="background.toString().padStart(4, '0')"
></app-background-art>
</ion-col>
Expand Down

0 comments on commit 7bc312d

Please sign in to comment.