From fdb1bcb282dc8dcb943b09b8c72ea003ea90d4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joe=20K=C3=BCng?= Date: Tue, 3 Mar 2026 09:44:35 +0100 Subject: [PATCH] fix(back-end): noozle diameter --- .../service/OrcaProfileResolver.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/printcalculator/service/OrcaProfileResolver.java b/backend/src/main/java/com/printcalculator/service/OrcaProfileResolver.java index 137c97b..26f0d88 100644 --- a/backend/src/main/java/com/printcalculator/service/OrcaProfileResolver.java +++ b/backend/src/main/java/com/printcalculator/service/OrcaProfileResolver.java @@ -100,11 +100,11 @@ public class OrcaProfileResolver { String displayName = machine.getPrinterDisplayName(); if (displayName.toLowerCase().contains("bambulab a1") || displayName.toLowerCase().contains("bambu lab a1")) { - BigDecimal normalizedNozzle = normalizeNozzle(nozzleDiameterMm); - if (normalizedNozzle == null) { + String nozzleForProfile = formatNozzleForProfileName(nozzleDiameterMm); + if (nozzleForProfile == null) { return "Bambu Lab A1 0.4 nozzle"; } - return "Bambu Lab A1 " + normalizedNozzle.toPlainString() + " nozzle"; + return "Bambu Lab A1 " + nozzleForProfile + " nozzle"; } return displayName; @@ -131,6 +131,18 @@ public class OrcaProfileResolver { return nozzleDiameterMm.setScale(2, RoundingMode.HALF_UP); } + private String formatNozzleForProfileName(BigDecimal nozzleDiameterMm) { + BigDecimal normalizedNozzle = normalizeNozzle(nozzleDiameterMm); + if (normalizedNozzle == null) { + return null; + } + BigDecimal stripped = normalizedNozzle.stripTrailingZeros(); + if (stripped.scale() < 0) { + stripped = stripped.setScale(0); + } + return stripped.toPlainString(); + } + public record ResolvedProfiles( String machineProfileName, String filamentProfileName,