Change mining profiles to be ordered by date descending.
This commit is contained in:
parent
449ee0f782
commit
52645fc89d
|
@ -71,7 +71,7 @@ export class ManageprofilesComponent implements OnInit {
|
||||||
this.manageProfilesService.getUsersProfiles()
|
this.manageProfilesService.getUsersProfiles()
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.allUsersProfiles = res;
|
this.allUsersProfiles = res.sort(this.sortByDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ export class ManageprofilesComponent implements OnInit {
|
||||||
this.manageProfilesService.getSavedProfiles()
|
this.manageProfilesService.getSavedProfiles()
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.userSavedProfiles = res;
|
this.userSavedProfiles = res.sort(this.sortByDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,18 @@ export class ManageprofilesComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sortByDate(a: any, b: any): number {
|
||||||
|
const aDate = new Date(a.datecreated);
|
||||||
|
const bDate = new Date(b.datecreated);
|
||||||
|
if (aDate.getTime() > bDate.getTime()) {
|
||||||
|
return -1;
|
||||||
|
} else if (aDate.getTime() < bDate.getTime()) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private clearLocalStorage(): void {
|
private clearLocalStorage(): void {
|
||||||
// clear localstorage values
|
// clear localstorage values
|
||||||
localStorage.removeItem('grants');
|
localStorage.removeItem('grants');
|
||||||
|
|
Loading…
Reference in New Issue