fix: activity log now shows machine_id/name, 164 Disney assets updated with park data, WO date range defaults to week
This commit is contained in:
@@ -1537,9 +1537,21 @@ def create_checkin(body: CheckinCreate, request: Request):
|
|||||||
row = conn.execute("SELECT created_at FROM checkins WHERE id = ?", (checkin_id,)).fetchone()
|
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"])
|
_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,
|
_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)
|
user_id=user_id)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
@@ -3515,7 +3527,7 @@ async def workorders_list(
|
|||||||
params: list = []
|
params: list = []
|
||||||
|
|
||||||
# Date field validation
|
# 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:
|
if date_field not in valid_date_fields:
|
||||||
date_field = "createdon"
|
date_field = "createdon"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4192,7 +4192,7 @@
|
|||||||
// WORK ORDERS TAB
|
// 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;
|
let woOffset = 0;
|
||||||
const WO_PAGE_SIZE = 50;
|
const WO_PAGE_SIZE = 50;
|
||||||
let woTotal = 0;
|
let woTotal = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user