Cleanup of removed condition column in favor of new status column.

This commit is contained in:
Yaro Kasear 2025-10-24 11:25:50 -05:00
parent acefd96958
commit c20d085ab5
3 changed files with 2 additions and 14 deletions

View file

@ -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)

View file

@ -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"}},

View file

@ -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,