mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 05:35:30 +02:00
[PR #705] [CLOSED] [Feature] - Printer optional depreciation cost #1096
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#1096
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/705
Author: @wreuel
Created: 3/14/2026
Status: ❌ Closed
Base:
dev← Head:feature/printerOptionalDepreciationCost📝 Commits (4)
5bfd55fAdding the information to have the depreciation cost on the archivesb244a73Adding test fir the depreciation11a3935Adding the depreciation cost on stas and archivesd949d5bMerge branch 'dev' into feature/printerOptionalDepreciationCost📊 Changes
20 files changed (+1184 additions, -18 deletions)
View changed files
📝
backend/app/api/routes/archives.py(+39 -0)📝
backend/app/core/database.py(+16 -0)📝
backend/app/models/archive.py(+3 -0)📝
backend/app/models/printer.py(+2 -0)📝
backend/app/schemas/archive.py(+5 -0)📝
backend/app/schemas/printer.py(+8 -0)📝
backend/app/services/usage_tracker.py(+13 -1)➕
backend/tests/integration/test_depreciation_cost_api.py(+290 -0)➕
backend/tests/unit/test_depreciation_cost.py(+320 -0)➕
frontend/src/__tests__/pages/DepreciationCost.test.tsx(+299 -0)📝
frontend/src/__tests__/pages/StatsPage.test.tsx(+26 -1)📝
frontend/src/api/client.ts(+6 -0)📝
frontend/src/components/FilamentTrends.tsx(+2 -2)📝
frontend/src/components/MetricToggle.tsx(+3 -2)📝
frontend/src/i18n/locales/de.ts(+6 -0)📝
frontend/src/i18n/locales/en.ts(+6 -0)📝
frontend/src/pages/ArchivesPage.tsx(+8 -1)📝
frontend/src/pages/PrintersPage.tsx(+58 -0)📝
frontend/src/pages/StatsPage.tsx(+56 -9)📝
pyproject.toml(+18 -2)📄 Description
Description
Adds optional per-print depreciation cost tracking based on a printer's purchase price and expected lifespan.
How it works
Users can optionally set Purchase Price and Lifespan (hours) on any printer via the Add or Edit printer modal. When both values are configured, the system automatically calculates a depreciation cost for each print:
depreciation_cost = (purchase_price / lifespan_hours) × (print_time_seconds / 3600)
For example, a $600 printer with a 3,000-hour lifespan costs $0.20/hour. A 2-hour print would have a depreciation cost of $0.40.
Where it appears
Recalculation
Depreciation cost is calculated:
This means if a printer's purchase price is corrected after the fact, hitting Recalculate Costs will update all associated archives.
Fully optional
Both fields default to null. If either is missing, no depreciation cost is calculated and nothing changes in the UI — existing workflows are completely unaffected.
Related Issue
#694
Fixes #
Type of Change
Changes Made
Screenshots
Testing
Checklist
Additional Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.