Add accommodation to permanent sort options

This commit is contained in:
Patrick Gebhardt 2020-06-23 21:36:16 +02:00
parent 1fb6f607a2
commit 846410e6bf
2 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,7 @@
<mat-divider *ngIf="result.total_accommodation_costs"></mat-divider>
<div *ngIf="result.total_accommodation_costs" class="total-accommodation">
<mat-icon>euro</mat-icon>
<span>{{result.total_accommodation_costs|number:'1.2-2'}}€</span>
<span matTooltip="Total accommodation">{{result.total_accommodation_costs|number:'1.2-2'}}€</span>
</div>
<mat-divider *ngIf="result.scores.length > 0"></mat-divider>
<div class="searched-params">

View File

@ -53,12 +53,15 @@ export class SearchComponent implements OnInit {
this.sortOptions = [
{name: 'Relevance', property: 'score', descending: true},
{name: 'Name', property: 'name'}
{name: 'Name', property: 'name'},
{name: 'Accommodation', property: 'accommodation_costs'}
];
if (this.results.length > 0) {
this.results[0].scores.forEach(({type}) => {
this.sortOptions.push({name: type, property: type, isScore: true});
if (!this.sortOptions.find(i => i.property === type)) {
this.sortOptions.push({name: type, property: type, isScore: true});
}
});
}