mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
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
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-maziggy-1#1053
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/465
Author: @Keybored02
Created: 2/20/2026
Status: ❌ Closed
Base:
0.2.1b2← Head:feature/cost_tracker📝 Commits (10+)
04ffca2Add cost tracking for spools and usage history0e50285Merge branch '0.2.1b' into feature/cost_trackerc72366cMerge branch '0.2.1' into feature/cost_tracker5cda70aMerge branch '0.2.1b2' into feature/cost_tracker8043bb1Refactor cost calculation logic to prioritize spool usage history and update schema validation for cost_per_kg380edfcMerge branch '0.2.1b2' into feature/cost_tracker071c2c7Refactor cost calculation logic to utilize pre-fetched spool usage costs and remove redundant imports; update InventoryPage to adjust cost display format9f19e8aAdd currency symbol, hide projected cost for no costs configured, add cost rounding to decimal point, fixed isExternal logic1dd266bRefactor functions in cost statistics integration tests427b08fAdd archive_id to SpoolUsageHistory model and update cost calculations in usage_tracker📊 Changes
26 files changed (+1314 additions, -22 deletions)
View changed files
📝
backend/app/api/routes/archives.py(+59 -17)📝
backend/app/core/database.py(+21 -0)📝
backend/app/main.py(+1 -0)📝
backend/app/models/spool.py(+4 -0)📝
backend/app/models/spool_usage_history.py(+2 -0)📝
backend/app/schemas/spool.py(+2 -0)📝
backend/app/schemas/spool_usage.py(+1 -0)📝
backend/app/services/usage_tracker.py(+70 -0)📝
backend/tests/conftest.py(+3 -0)➕
backend/tests/integration/test_cost_statistics.py(+426 -0)➕
backend/tests/unit/test_cost_tracking.py(+592 -0)📝
frontend/src/api/client.ts(+2 -0)📝
frontend/src/components/PrintModal/FilamentMapping.tsx(+48 -2)📝
frontend/src/components/PrintModal/index.tsx(+6 -0)📝
frontend/src/components/PrintModal/types.ts(+2 -0)📝
frontend/src/components/SpoolFormModal.tsx(+5 -1)📝
frontend/src/components/spool-form/AdditionalSection.tsx(+24 -0)📝
frontend/src/components/spool-form/types.ts(+3 -0)📝
frontend/src/i18n/locales/de.ts(+2 -0)📝
frontend/src/i18n/locales/en.ts(+2 -0)...and 6 more files
📄 Description
Description
Follow up to PR #454
This PR implements per-spool cost tracking, with localization and test coverage. The objective is to allow the user to set a cost per Kg when adding a new spool to the integrated Inventory. This field is then used to calculate print cost based on weight used for each spool. The Statistics page shows the filament cost based on this calculation. If no cost is present, the default cost specified in Settings is used instead. This PR also introduces changes to the Archive object card to show last print total cost and to the Print card to show projected total cost based on the Filament Mapping the user chooses. In the Filament page, an optional cost column has been added. All locales have been updated with the required fields. A new set of tests has been added and verified.
Related Issue
Fixes #452
Type of Change
Changes Made
cost_per_kgandspool_usage_historyto database fieldscostfield toarchive.pyusage_tracker.pywith fallback to defaults (usesweight_gramsto be able to handle failed prints)main.pyby summing usage costarchives.pywith total cost calculation for Statistics page usagebackend/tests/unit/test_cost_tracking.pytest_cost_with_spool_specific_cost_per_kgtest_cost_with_default_fallbacktest_cost_zero_when_default_cost_is_zerotest_cost_for_failed_print_uses_actual_usagetest_cost_with_ams_fallback_trackingtest_multi_filament_cost_aggregationtest_costs_summed_in_archivetest_null_costs_handled_in_aggregationbackend/tests/integration/test_cost_statistics.pytest_archive_has_cost_fieldtest_statistics_includes_total_costtest_statistics_aggregates_costs_correctlytest_statistics_handles_null_coststest_statistics_includes_failed_print_coststest_spool_cost_fields_persisttest_spool_update_cost_fieldstest_cost_with_different_currenciesScreenshots
Testing
Checklist
Additional Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.