Improve asset sorting by brand, model, and QR code with null handling
All checks were successful
Build / build (push) Successful in 2m27s
Deploy / build (push) Successful in 3m1s

This commit is contained in:
2025-06-15 09:48:07 +02:00
parent 35c2e07c05
commit bb15c55e46

View File

@@ -96,7 +96,10 @@ public class WebController {
model.addAttribute(DESCRIPTORS, tree);
model.addAttribute(PROPERTIES, tree.stream().flatMap(d -> d.getProperties().stream()).toList());
var assets = assetService.getAssetsByType(type);
assets.sort(Comparator.comparing(Asset::getQr));
assets.sort(Comparator
.comparing((Asset a) -> a.getAsset().getBrand(), Comparator.nullsFirst(Comparator.naturalOrder()))
.thenComparing((Asset a) -> a.getAsset().getModel(), Comparator.nullsFirst(Comparator.naturalOrder()))
.thenComparing(Asset::getQr));
model.addAttribute(ASSETS, assets);
return "browse_type";
}