mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 05:35:30 +02:00
[PR #414] [MERGED] Fix: Spool Empty Weight Catalog Matching by ID #1033
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy#1033
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/maziggy/bambuddy/pull/414
Author: @Keybored02
Created: 2/17/2026
Status: ✅ Merged
Merged: 2/18/2026
Merged by: @maziggy
Base:
0.2.1b← Head:feature/filament-fix📝 Commits (6)
233f50cfix(inventory): spool catalog entry ID matchinge17b55fAdd tests for core_weight_catalog_id handlingb0d341aMerge branch '0.2.1b' into feature/filament-fix87c6bfefix(spool-form): improve handling of core_weight_catalog_id and catalog ID selection logica649a24Merge branch 'feature/filament-fix' of https://github.com/Keybored02/bambuddy into feature/filament-fix72f5bd4Merge branch '0.2.1b' into feature/filament-fix📊 Changes
8 files changed (+206 additions, -9 deletions)
View changed files
📝
backend/app/core/database.py(+6 -0)📝
backend/app/models/spool.py(+3 -0)📝
backend/app/schemas/spool.py(+2 -0)📝
frontend/src/__tests__/components/SpoolFormModal.test.tsx(+135 -0)📝
frontend/src/api/client.ts(+1 -0)📝
frontend/src/components/SpoolFormModal.tsx(+2 -0)📝
frontend/src/components/spool-form/AdditionalSection.tsx(+55 -9)📝
frontend/src/components/spool-form/types.ts(+2 -0)📄 Description
Description
The
SpoolWeightPickercomponent matched catalog entries by weight value only, usingfind()which returns the first match. This approach is ambiguous when duplicate weights exist in the catalog.Implemented unique identification using catalog entry IDs:
Related Issue
Fixes #413
Type of Change
Changes Made
Backend
core_weight_catalog_id: Mapped[int | None]field to track which catalog entry was usedcore_weight_catalog_id: int | None = NonetoSpoolBaseschemacore_weight_catalog_id: int | None = NonetoSpoolUpdateschemarun_migrations()Frontend
Updated
SpoolFormDatainterface to includecore_weight_catalog_id: number | nullUpdated
defaultFormDatato initializecore_weight_catalog_id: nullModified
SpoolWeightPickercomponent signature:catalogIdandonCatalogIdChangeparametersselectedIdstate (replaced withcatalogIdprop)core_weight_catalog_idto form initialization when editing spoolscore_weight_catalog_idcore_weight_catalog_idto passed props inSpoolWeightPickercallcore_weight_catalog_id: number | nulltoInventorySpoolinterfaceTests
"preserves core_weight_catalog_id when editing other fields"
Verifies catalog ID persists when editing unrelated fields. Edit note → submit → assert
core_weight_catalog_id: 5in PATCH."includes core_weight_catalog_id when selecting from catalog"
Verifies both weight and ID sent on creation. Select catalog entry → submit → assert
core_weight: 250, core_weight_catalog_id: 2in POST."displays correct catalog name when duplicates exist"
Verifies ID-based lookup works with duplicate weights. Load spool with
catalogId: 2from catalog with duplicate 250g entries → assert "Bambu Lab 250g" displays, not "Generic 250g".Screenshots
Testing
Checklist
Additional Notes
New test added - please validate
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.