diff --git a/SystemKonkursow/4.2.1/angular/src/app/app.module.ts b/SystemKonkursow/4.2.1/angular/src/app/app.module.ts index 23d23dc..0f6245e 100644 --- a/SystemKonkursow/4.2.1/angular/src/app/app.module.ts +++ b/SystemKonkursow/4.2.1/angular/src/app/app.module.ts @@ -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: [ diff --git a/SystemKonkursow/4.2.1/angular/src/app/competitions-list/competitions-list.component.html b/SystemKonkursow/4.2.1/angular/src/app/competitions-list/competitions-list.component.html index 0c76733..27a09d1 100644 --- a/SystemKonkursow/4.2.1/angular/src/app/competitions-list/competitions-list.component.html +++ b/SystemKonkursow/4.2.1/angular/src/app/competitions-list/competitions-list.component.html @@ -1,5 +1,5 @@
-
+
{{ competition.name }}
\ No newline at end of file diff --git a/SystemKonkursow/4.2.1/angular/src/app/pipe/filter-classes.pipe.ts b/SystemKonkursow/4.2.1/angular/src/app/pipe/filter-classes.pipe.ts new file mode 100644 index 0000000..04f9dff --- /dev/null +++ b/SystemKonkursow/4.2.1/angular/src/app/pipe/filter-classes.pipe.ts @@ -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); + } +} \ No newline at end of file