Fix minor search issues

- Reset sorting for a new search
- Descending sort is default for tags
This commit is contained in:
Patrick Gebhardt 2020-06-25 20:14:22 +02:00
parent ad1c728876
commit aa4c994069

View File

@ -61,12 +61,16 @@ export class SearchComponent implements OnInit {
{name: 'Price', property: 'average_per_day_costs'}
];
this.sortBy = 'score';
this.sortDes = true;
if (this.results.length > 0) {
this.results[0].scores.forEach(({type}) => {
const tags = await this.ss.getAvailableTags();
for (const {type} of this.results[0].scores) {
if (!this.sortOptions.find(i => i.property === type)) {
this.sortOptions.push({name: type, property: type, isScore: true});
this.sortOptions.push({name: type, property: type, isScore: true, descending: tags.includes(type)});
}
});
}
}
// Calculate duration