Cleanup of removed condition column in favor of new status column.
This commit is contained in:
parent
acefd96958
commit
c20d085ab5
3 changed files with 2 additions and 14 deletions
|
|
@ -17,7 +17,6 @@ class Inventory(Base, CRUDMixin):
|
||||||
name: Mapped[Optional[str]] = mapped_column(Unicode(255), index=True)
|
name: Mapped[Optional[str]] = mapped_column(Unicode(255), index=True)
|
||||||
serial: 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: Mapped[Optional['Status']] = relationship('Status', back_populates='inventory')
|
||||||
condition_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey('status.id'), nullable=True, index=True)
|
condition_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey('status.id'), nullable=True, index=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,17 +54,6 @@ def _fields_for_model(model: str):
|
||||||
"label_spec": "{name} - {room_function.description}"},
|
"label_spec": "{name} - {room_function.description}"},
|
||||||
{"name": "condition", "label": "Condition", "row": "status", "wrap": {"class": "col"},
|
{"name": "condition", "label": "Condition", "row": "status", "wrap": {"class": "col"},
|
||||||
"label_attrs": {"class": "form-label"}, "label_spec": "{description}"},
|
"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}",
|
{"name": "image", "label": "", "row": "image", "type": "template", "label_spec": "{filename}",
|
||||||
"template": "image_display.html", "attrs": {"class": "img-fluid img-thumbnail h-auto"},
|
"template": "image_display.html", "attrs": {"class": "img-fluid img-thumbnail h-auto"},
|
||||||
"wrap": {"class": "h-100 w-100"}},
|
"wrap": {"class": "h-100 w-100"}},
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ def init_reports_routes(app):
|
||||||
rows = inventory_service.list({
|
rows = inventory_service.list({
|
||||||
"limit": 0,
|
"limit": 0,
|
||||||
"sort": "device_type.description",
|
"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])
|
df = pd.DataFrame([r.as_dict() for r in rows])
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ def init_reports_routes(app):
|
||||||
|
|
||||||
pt = df.pivot_table(
|
pt = df.pivot_table(
|
||||||
index="device_type.description",
|
index="device_type.description",
|
||||||
columns="condition",
|
columns="condition.description",
|
||||||
values="id",
|
values="id",
|
||||||
aggfunc="count",
|
aggfunc="count",
|
||||||
fill_value=0,
|
fill_value=0,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue