Spool Adjustment History - Track usage with timestamps and comments #6

Closed
opened 2026-01-15 01:20:42 +00:00 by tonym · 0 comments
Owner

Problem

From user feedback:

Im frustrated when I have a series of prints planned, with one or more filaments, or a failure and I need to reprint, and I cant remember if Ive decremented the weight for each print.

Solution

Track all spool weight/length adjustments with history.

New Database Table

SpoolAdjustment in spoolman/database/models.py:

class SpoolAdjustment(Base):
    __tablename__ = "spool_adjustment"
    id: Mapped[int] = mapped_column(primary_key=True)
    spool_id: Mapped[int] = mapped_column(ForeignKey("spool.id", ondelete="CASCADE"))
    timestamp: Mapped[datetime] = mapped_column(default=datetime.utcnow)
    adjustment_type: Mapped[str]  # "weight" or "length"
    value: Mapped[float]  # Amount adjusted (negative = used, positive = added)
    comment: Mapped[Optional[str]]

    spool: Mapped["Spool"] = relationship(back_populates="adjustments")

API Changes

  • Update use_spool_weight and use_spool_length to record adjustments
  • Add optional comment parameter to use endpoints
  • Add GET /api/v1/spool/{id}/adjustments endpoint

Frontend Changes

  • Add "Adjustment History" section to spool show page
  • Add comment field to adjustment dialog

Priority

Medium - requires migration and new table

## Problem From user feedback: > Im frustrated when I have a series of prints planned, with one or more filaments, or a failure and I need to reprint, and I cant remember if Ive decremented the weight for each print. ## Solution Track all spool weight/length adjustments with history. ### New Database Table **`SpoolAdjustment` in `spoolman/database/models.py`:** ```python class SpoolAdjustment(Base): __tablename__ = "spool_adjustment" id: Mapped[int] = mapped_column(primary_key=True) spool_id: Mapped[int] = mapped_column(ForeignKey("spool.id", ondelete="CASCADE")) timestamp: Mapped[datetime] = mapped_column(default=datetime.utcnow) adjustment_type: Mapped[str] # "weight" or "length" value: Mapped[float] # Amount adjusted (negative = used, positive = added) comment: Mapped[Optional[str]] spool: Mapped["Spool"] = relationship(back_populates="adjustments") ``` ### API Changes - Update `use_spool_weight` and `use_spool_length` to record adjustments - Add optional `comment` parameter to use endpoints - Add `GET /api/v1/spool/{id}/adjustments` endpoint ### Frontend Changes - Add "Adjustment History" section to spool show page - Add comment field to adjustment dialog ## Priority Medium - requires migration and new table
tonym closed this issue 2026-01-16 03:41:13 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tonym/spoolman2#6
No description provided.