Sort walkers by distance, photo presence, and average rating in HomeViewModel
This commit is contained in:
parent
421672e8cb
commit
d72c84ef5f
@ -539,7 +539,12 @@ namespace gehGassiApp.ViewModels
|
|||||||
request.Distance = Location.CalculateDistance(CurrentLocation.Lat.Value, CurrentLocation.Lng.Value, request.Lat, request.Lng, DistanceUnits.Kilometers);
|
request.Distance = Location.CalculateDistance(CurrentLocation.Lat.Value, CurrentLocation.Lng.Value, request.Lat, request.Lng, DistanceUnits.Kilometers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Walkers = requests.Value.ToObservableCollection();
|
// Sortierung: Entfernung, dann mit Foto, dann mit Rating
|
||||||
|
Walkers = requests.Value
|
||||||
|
.OrderBy(x => x.Distance)
|
||||||
|
.ThenByDescending(x => !string.IsNullOrWhiteSpace(x.Photo))
|
||||||
|
.ThenByDescending(x => x.AverageRating > 0)
|
||||||
|
.ToObservableCollection();
|
||||||
|
|
||||||
_total = requests.Total;
|
_total = requests.Total;
|
||||||
_skip = requests.Skip + requests.Take;
|
_skip = requests.Skip + requests.Take;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user