From 11673eb515b34724de176f90a5a7b57b004359cc Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Mon, 8 Sep 2025 10:12:57 -0500 Subject: [PATCH] Remove obsolete junk. --- crudkit/mixins.py | 12 +++--------- inventory/models/work_log.py | 16 +++++----------- inventory/routes/helpers.py | 2 -- inventory/templates/worklog.html | 20 -------------------- 4 files changed, 8 insertions(+), 42 deletions(-) diff --git a/crudkit/mixins.py b/crudkit/mixins.py index 38a0e71..03f2f9c 100644 --- a/crudkit/mixins.py +++ b/crudkit/mixins.py @@ -7,17 +7,11 @@ class CrudMixin: id = Column(Integer, primary_key=True) created_at = Column(DateTime, default=dt.datetime.utcnow, nullable=False) updated_at = Column(DateTime, default=dt.datetime.utcnow, onupdate=dt.datetime.utcnow, nullable=False) - deleted = Column("deleted", Boolean, default=False, nullable=False) - version = Column(Integer, default=1, nullable=False) + is_deleted = Column(Boolean, default=False, nullable=False) @hybrid_property def is_deleted(self): - return self.deleted + return self.is_deleted def mark_deleted(self): - self.deleted = True - self.version += 1 - - @declared_attr - def __mapper_args__(cls): - return {"version_id_col": cls.version} + self.is_deleted = True diff --git a/inventory/models/work_log.py b/inventory/models/work_log.py index c365cb3..f1a8d06 100644 --- a/inventory/models/work_log.py +++ b/inventory/models/work_log.py @@ -21,11 +21,11 @@ class WorkLog(db.Model, ImageAttachable, CrudMixin): id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True) start_time: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime) end_time: Mapped[Optional[datetime.datetime]] = mapped_column(DateTime) - notes: Mapped[Optional[str]] = mapped_column(Unicode()) + # notes: Mapped[Optional[str]] = mapped_column(Unicode()) complete: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))')) - followup: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))')) + # followup: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))')) contact_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("users.id"), nullable=True, index=True) - analysis: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))')) + # analysis: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))')) work_item_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("inventory.id"), nullable=True, index=True) work_item: Mapped[Optional['Inventory']] = relationship('Inventory', back_populates='work_logs') @@ -42,28 +42,22 @@ class WorkLog(db.Model, ImageAttachable, CrudMixin): self, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - notes: Optional[str] = None, complete: Optional[bool] = False, - followup: Optional[bool] = False, contact_id: Optional[int] = None, - analysis: Optional[bool] = False, work_item_id: Optional[int] = None, updates: Optional[List[WorkNote]] = None ) -> None: self.start_time = start_time self.end_time = end_time - self.notes = notes self.complete = complete - self.followup = followup self.contact_id = contact_id - self.analysis = analysis self.work_item_id = work_item_id self.updates = updates or [] def __repr__(self): return f"" + f"complete={self.complete}, " \ + f"contact_id={self.contact_id}, work_item_id={self.work_item_id})>" def serialize(self): return { diff --git a/inventory/routes/helpers.py b/inventory/routes/helpers.py index 7dbedb2..775c228 100644 --- a/inventory/routes/helpers.py +++ b/inventory/routes/helpers.py @@ -90,8 +90,6 @@ worklog_headers = { "Start Time": lambda i: {"text": i.start_time.strftime("%Y-%m-%d")}, "End Time": lambda i: {"text": i.end_time.strftime("%Y-%m-%d")} if i.end_time else {"text": None}, "Complete?": lambda i: {"text": i.complete, "type": "bool", "html": checked_box if i.complete else unchecked_box}, - "Follow Up?": lambda i: {"text": i.followup, "type": "bool", "html": checked_box if i.followup else unchecked_box, "highlight": i.followup}, - "Quick Analysis?": lambda i: {"text": i.analysis, "type": "bool", "html": checked_box if i.analysis else unchecked_box}, } def link(text, endpoint, **values): diff --git a/inventory/templates/worklog.html b/inventory/templates/worklog.html index 5f0d669..faad52b 100644 --- a/inventory/templates/worklog.html +++ b/inventory/templates/worklog.html @@ -21,8 +21,6 @@ start_time: document.querySelector("input[name='start']").value, end_time: document.querySelector("input[name='end']").value, complete: document.querySelector("input[name='complete']").checked, - analysis: document.querySelector("input[name='analysis']").checked, - followup: document.querySelector("input[name='followup']").checked, contact_id: parseInt(document.querySelector("input[name='contact']").value) || null, work_item_id: parseInt(document.querySelector("input[name='item']").value) || null, updates: updates @@ -182,24 +180,6 @@ -
-
- - -
-
-
-
- - -
-