From c20d085ab54c0a4dd8e7854125eaa1205733893a Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Fri, 24 Oct 2025 11:25:50 -0500 Subject: [PATCH] Cleanup of removed condition column in favor of new status column. --- inventory/models/inventory.py | 1 - inventory/routes/entry.py | 11 ----------- inventory/routes/reports.py | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/inventory/models/inventory.py b/inventory/models/inventory.py index 78617be..6c9db32 100644 --- a/inventory/models/inventory.py +++ b/inventory/models/inventory.py @@ -17,7 +17,6 @@ class Inventory(Base, CRUDMixin): name: Mapped[Optional[str]] = mapped_column(Unicode(255), index=True) serial: Mapped[Optional[str]] = mapped_column(Unicode(255), index=True) - # condition: Mapped[str] = mapped_column(Unicode(255)) condition: Mapped[Optional['Status']] = relationship('Status', back_populates='inventory') condition_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey('status.id'), nullable=True, index=True) diff --git a/inventory/routes/entry.py b/inventory/routes/entry.py index 62a3cfa..951d56e 100644 --- a/inventory/routes/entry.py +++ b/inventory/routes/entry.py @@ -54,17 +54,6 @@ def _fields_for_model(model: str): "label_spec": "{name} - {room_function.description}"}, {"name": "condition", "label": "Condition", "row": "status", "wrap": {"class": "col"}, "label_attrs": {"class": "form-label"}, "label_spec": "{description}"}, - # {"name": "condition", "label": "Condition", "row": "status", "wrap": {"class": "col"}, - # "type": "select", "options": [ - # {"label": "Deployed", "value": "Deployed"}, - # {"label": "Working", "value": "Working"}, - # {"label": "Unverified", "value": "Unverified"}, - # {"label": "Partially Inoperable", "value": "Partially Inoperable"}, - # {"label": "Inoperable", "value": "Inoperable"}, - # {"label": "Removed", "value": "Removed"}, - # {"label": "Disposed", "value": "Disposed"}, - # ], - # "label_attrs": {"class": "form-label"}, "attrs": {"class": "form-control"}}, {"name": "image", "label": "", "row": "image", "type": "template", "label_spec": "{filename}", "template": "image_display.html", "attrs": {"class": "img-fluid img-thumbnail h-auto"}, "wrap": {"class": "h-100 w-100"}}, diff --git a/inventory/routes/reports.py b/inventory/routes/reports.py index b51486f..d1568f1 100644 --- a/inventory/routes/reports.py +++ b/inventory/routes/reports.py @@ -18,7 +18,7 @@ def init_reports_routes(app): rows = inventory_service.list({ "limit": 0, "sort": "device_type.description", - "fields": ["id", "condition", "device_type.description"], + "fields": ["id", "condition.description", "device_type.description"], }) df = pd.DataFrame([r.as_dict() for r in rows]) @@ -27,7 +27,7 @@ def init_reports_routes(app): pt = df.pivot_table( index="device_type.description", - columns="condition", + columns="condition.description", values="id", aggfunc="count", fill_value=0,