diff --git a/server.py b/server.py index e42c353..b20107b 100644 --- a/server.py +++ b/server.py @@ -1537,9 +1537,21 @@ def create_checkin(body: CheckinCreate, request: Request): row = conn.execute("SELECT created_at FROM checkins WHERE id = ?", (checkin_id,)).fetchone() _auto_log_visit(conn, user_id, body.asset_id, row["created_at"]) - # Activity log + # Activity log — include machine_id and name for clarity + asset_info = conn.execute( + "SELECT machine_id, name FROM assets WHERE id = ?", + (body.asset_id,) + ).fetchone() + asset_label = f"asset {body.asset_id}" + if asset_info: + mid = asset_info["machine_id"] or "" + nm = asset_info["name"] or "" + if mid and nm: + asset_label = f"{nm} (#{mid})" + elif mid: + asset_label = f"asset #{mid}" _log_activity(conn, "created", "checkin", checkin_id, - f"Check-in for asset {body.asset_id}", + f"Check-in for {asset_label}", user_id=user_id) conn.commit() @@ -3515,7 +3527,7 @@ async def workorders_list( params: list = [] # Date field validation - valid_date_fields = {"createdon", "msdyn_completedon"} + valid_date_fields = {"createdon", "msdyn_completedon", "msdyn_datewindowstart"} if date_field not in valid_date_fields: date_field = "createdon" diff --git a/static/index.html b/static/index.html index 380241e..c42b23d 100644 --- a/static/index.html +++ b/static/index.html @@ -4192,7 +4192,7 @@ // WORK ORDERS TAB // ═══════════════════════════════════════════════════════════════════════ - let woFilters = { q: '', status: null, tech: null, priority: null, work_type: null, date_range: 'all', date_from: null, date_to: null }; + let woFilters = { q: '', status: null, tech: null, priority: null, work_type: null, date_range: 'week', date_from: null, date_to: null }; let woOffset = 0; const WO_PAGE_SIZE = 50; let woTotal = 0;