Enhance asset display by handling null builds and sorting assets by QR code

This commit is contained in:
2025-06-15 09:26:08 +02:00
parent 14ac78982f
commit 0dbab45651
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package be.seeseepuff.pcinv.controllers;
import be.seeseepuff.pcinv.models.Asset;
import be.seeseepuff.pcinv.models.WorkLogEntry;
import be.seeseepuff.pcinv.services.AssetService;
import be.seeseepuff.pcinv.services.BuildService;
@@ -94,7 +95,9 @@ public class WebController {
model.addAttribute(DESCRIPTOR, assetService.getAssetDescriptor(type));
model.addAttribute(DESCRIPTORS, tree);
model.addAttribute(PROPERTIES, tree.stream().flatMap(d -> d.getProperties().stream()).toList());
model.addAttribute(ASSETS, assetService.getAssetsByType(type));
var assets = assetService.getAssetsByType(type);
assets.sort(Comparator.comparing(Asset::getQr));
model.addAttribute(ASSETS, assets);
return "browse_type";
}