Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/model/patron.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class Patron {
id: Number
fullName: string
amount: Number
amount: number
email: boolean
active: boolean
}
10 changes: 8 additions & 2 deletions src/app/patrons-list/patrons-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {PatronList} from "../model/patron.list";
import {PatronService} from "../service/patron.service";
import {Router} from "@angular/router";

@Component({
selector: 'app-patrons-list',
Expand All @@ -12,14 +11,21 @@ export class PatronsListComponent implements OnInit {

patronList: PatronList;

constructor(private patronService: PatronService, private router: Router) { }
constructor(private patronService: PatronService) { }

ngOnInit() {
this.patronService.getPatronList().subscribe(data => {
this.patronList = data;
this.sortPatronsByAmount();
});
}

sortPatronsByAmount(): void {
this.patronList.patrons.sort(function(a, b){
return b.amount - a.amount
})
}

transformPrice(val: number): number {
return val/100;
}
Expand Down