feat(back-end and front-end): calculator improvements

This commit is contained in:
2026-03-06 15:13:34 +01:00
parent 042c254691
commit b517373538
11 changed files with 35 additions and 41 deletions

View File

@@ -7,6 +7,7 @@ public class PrintSettingsDto {
// Common
private String material; // e.g. "PLA", "PLA TOUGH", "PETG"
private String color; // e.g. "White", "#FFFFFF"
private Integer quantity;
private Long filamentVariantId;
private Long printerMachineId;
@@ -58,6 +59,14 @@ public class PrintSettingsDto {
this.filamentVariantId = filamentVariantId;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Long getPrinterMachineId() {
return printerMachineId;
}

View File

@@ -239,7 +239,7 @@ public class QuoteSessionItemService {
item.setQuoteSession(session);
item.setOriginalFilename(originalFilename);
item.setStoredPath(quoteStorageService.toStoredPath(persistentPath));
item.setQuantity(1);
item.setQuantity(normalizeQuantity(settings.getQuantity()));
item.setColorCode(selectedVariant.getColorName());
item.setFilamentVariant(selectedVariant);
item.setMaterialCode(selectedVariant.getFilamentMaterialType() != null
@@ -279,4 +279,11 @@ public class QuoteSessionItemService {
item.setUpdatedAt(OffsetDateTime.now());
return item;
}
private int normalizeQuantity(Integer quantity) {
if (quantity == null || quantity < 1) {
return 1;
}
return quantity;
}
}