SKE-38 attempt filter list competitions
This commit is contained in:
parent
e1d9fa6ebc
commit
a09c5b8d0e
@ -34,6 +34,7 @@ import { SideBarFooterComponent } from '@app/layout/sidebar-footer.component';
|
||||
import { RightSideBarComponent } from '@app/layout/right-sidebar.component';
|
||||
import { CategoriesListComponent } from '@app/categories-list/categories-list.component';
|
||||
import { CompetitionsListComponent } from '@app/competitions-list/competitions-list.component';
|
||||
import { FilterClassesPipe } from '@app/pipe/filter-classes.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -56,7 +57,8 @@ import { CompetitionsListComponent } from '@app/competitions-list/competitions-l
|
||||
SideBarFooterComponent,
|
||||
RightSideBarComponent,
|
||||
CategoriesListComponent,
|
||||
CompetitionsListComponent
|
||||
CompetitionsListComponent,
|
||||
FilterClassesPipe
|
||||
|
||||
],
|
||||
imports: [
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="flex-container" id="competitions-list-area">
|
||||
<div class="flex-item" *ngFor="let competition of competitionsList">
|
||||
<div class="flex-item" *ngFor="let competition of (competitionsList | filterClasses : [2, 6])">
|
||||
{{ competition.name }}
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,15 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
import { CompetitionDto } from '@shared/service-proxies/service-proxies';
|
||||
|
||||
@Pipe({ name: 'filterClasses' })
|
||||
export class FilterClassesPipe implements PipeTransform {
|
||||
|
||||
transform(allCompetitions: CompetitionDto[], args?: any) {
|
||||
console.log(args);
|
||||
let minClass = args[0];
|
||||
let maxClass = args[1];
|
||||
return allCompetitions
|
||||
.filter(competition => competition.minClass >= minClass && competition.maxClass <= maxClass);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user