Skip to content

Commit

Permalink
feat: Adding Dungeon Vaulted Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
WorthyD committed Nov 22, 2020
1 parent db2db3e commit 00909ba
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 40 deletions.
3 changes: 2 additions & 1 deletion projects/bungie-models/src/lib/entities/dungeons/pit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const PitOfHeresy: Activity = {
abbreviatedName: 'Pit',
displayName: 'Pit of Heresy',
sortOrder: 2,
isGuidedGames: false
isGuidedGames: false,
isVaulted: false
};
3 changes: 2 additions & 1 deletion projects/bungie-models/src/lib/entities/dungeons/prophecy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const Prophecy: Activity = {
abbreviatedName: 'Prophecy',
displayName: 'Prophecy',
sortOrder: 3,
isGuidedGames: false
isGuidedGames: false,
isVaulted: false
};
3 changes: 2 additions & 1 deletion projects/bungie-models/src/lib/entities/dungeons/throne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const ShatteredThrone: Activity = {
abbreviatedName: 'Throne',
displayName: 'Shattered Throne',
sortOrder: 1,
isGuidedGames: false
isGuidedGames: false,
isVaulted: false
};
6 changes: 4 additions & 2 deletions projects/bungie-models/src/lib/entities/dungeons/whisper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const Whisper: Activity = {
abbreviatedName: 'Whisper',
displayName: 'The Whisper',
sortOrder: 6,
isGuidedGames: false
isGuidedGames: false,
isVaulted: true
};

export const WhisperHeroic: Activity = {
Expand All @@ -15,5 +16,6 @@ export const WhisperHeroic: Activity = {
abbreviatedName: 'Whisper - Heroic',
displayName: 'The Whisper (Heroic)',
sortOrder: 7,
isGuidedGames: false
isGuidedGames: false,
isVaulted: true
}
6 changes: 4 additions & 2 deletions projects/bungie-models/src/lib/entities/dungeons/zero-hour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const ZeroHour: Activity = {
abbreviatedName: 'Zero Hour',
displayName: 'Zero Hour',
sortOrder: 8,
isGuidedGames: false
isGuidedGames: false,
isVaulted: true
};

export const ZeroHourHeroic: Activity = {
Expand All @@ -15,5 +16,6 @@ export const ZeroHourHeroic: Activity = {
abbreviatedName: 'Zero Hour (Heroic)',
displayName: 'Zero Hour (Heroic)',
sortOrder: 9,
isGuidedGames: false
isGuidedGames: false,
isVaulted: true
};
1 change: 1 addition & 0 deletions projects/bungie-models/src/lib/models/ActivityStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface Activity {
hashes: number[];
sortOrder: number;
isGuidedGames: boolean;
isVaulted?: boolean;
}
export interface ActivityStats {
memberProfile: MemberProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ export const MOCK_DUNGEON_STATS = [];
function getRandomNumber() {
return Math.floor(Math.random() * 100 + 1);
}

import { AllDungeons } from 'bungie-models';
users.forEach((u) => {
const stats = {};
AllDungeons.forEach((r) => {
stats[r.key] = {
activityCompletions: getRandomNumber()
};
});

MOCK_DUNGEON_STATS.push({
memberProfile: {
profile: {
Expand All @@ -19,32 +26,7 @@ users.forEach((u) => {
}
}
},
stats: {
shat: {
activityCompletions: getRandomNumber()
},
pit: {
activityCompletions: getRandomNumber()
},
proph: {
activityCompletions: getRandomNumber()
},
wis: {
activityCompletions: getRandomNumber()
},
wish: {
activityCompletions: getRandomNumber()
},
zero: {
activityCompletions: getRandomNumber()
},
zeroh: {
activityCompletions: getRandomNumber()
},
labs: {
activityCompletions: getRandomNumber()
}
}
stats
});
});
console.log(MOCK_DUNGEON_STATS);
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container>
<!-- <ng-container *ngIf="!isLoading; else loading"> -->
<ng-container *ngIf="memberDungeonStats">
<mat-checkbox class="m-3" color="primary" (change)="changeVaulted($event)">Show Vaulted Content</mat-checkbox>
<table mat-table [dataSource]="sortedData" matSort class="mat-elevation-z8" matSortStart="desc"
(matSortChange)="sortData($event)">
<ng-container matColumnDef="loadingRow">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export class ClanDungeonStatTableComponent implements OnInit {
get memberDungeonStats(): ActivityStats[] {
return this._memberDungeonStats;
}
set memberDungeonStats(value){
set memberDungeonStats(value) {
this._memberDungeonStats = value;
this.sortedData = value.slice();
}

@Input()
isLoading: boolean = true;

showVaultedContent = false;
allDungeons;
sortedData: ActivityStats[];
allDungeons = AllDungeons;
raidColumnsKeys: string[];
displayedColumns: string[];

Expand All @@ -35,9 +35,17 @@ export class ClanDungeonStatTableComponent implements OnInit {
this.updateColumns();
}
updateColumns() {
this.allDungeons = this.getDungeons();
this.displayedColumns = ['displayName', ...this.allDungeons.map((x) => x.key), 'dungeonLink'];
}

getDungeons() {
return AllDungeons.filter((x) => {
if (this.showVaultedContent === false) {
return x.isVaulted === false;
}
return true;
}).sort((a, b) => a.sortOrder - b.sortOrder);
}
sortData(sort: Sort) {
const data = this.memberDungeonStats.slice();
if (!sort.active || sort.direction === '') {
Expand All @@ -58,6 +66,8 @@ export class ClanDungeonStatTableComponent implements OnInit {
}
});
}


changeVaulted(event) {
this.showVaultedContent = event.checked;
this.updateColumns();
}
}

0 comments on commit 00909ba

Please sign in to comment.