diff --git a/backend/src/main/java/com/printcalculator/controller/OptionsController.java b/backend/src/main/java/com/printcalculator/controller/OptionsController.java index 7eb7251..f07d4bd 100644 --- a/backend/src/main/java/com/printcalculator/controller/OptionsController.java +++ b/backend/src/main/java/com/printcalculator/controller/OptionsController.java @@ -64,6 +64,20 @@ public class OptionsController { }) .filter(m -> m != null) .collect(Collectors.toList()); + + // Sort: PLA first, then PETG, then others alphabetically + materialOptions.sort((a, b) -> { + String codeA = a.code(); + String codeB = b.code(); + + if (codeA.equals("pla_basic")) return -1; + if (codeB.equals("pla_basic")) return 1; + + if (codeA.equals("petg_basic")) return -1; + if (codeB.equals("petg_basic")) return 1; + + return codeA.compareTo(codeB); + }); // 2. Qualities (Static as per user request) List qualities = List.of( diff --git a/frontend/src/app/features/calculator/components/upload-form/upload-form.component.ts b/frontend/src/app/features/calculator/components/upload-form/upload-form.component.ts index 917284c..1c98a5f 100644 --- a/frontend/src/app/features/calculator/components/upload-form/upload-form.component.ts +++ b/frontend/src/app/features/calculator/components/upload-form/upload-form.component.ts @@ -112,7 +112,9 @@ export class UploadFormComponent implements OnInit { private setDefaults() { // Set Defaults if available if (this.materials().length > 0 && !this.form.get('material')?.value) { - this.form.get('material')?.setValue(this.materials()[0].value); + // Prefer PLA Basic, otherwise first available + const pla = this.materials().find(m => m.value === 'pla_basic'); + this.form.get('material')?.setValue(pla ? pla.value : this.materials()[0].value); } if (this.qualities().length > 0 && !this.form.get('quality')?.value) { // Try to find 'standard' or use first