diff --git a/api_shopfloor.asp b/api_shopfloor.asp index 6d508a9..82fded6 100644 --- a/api_shopfloor.asp +++ b/api_shopfloor.asp @@ -17,11 +17,11 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _ "nt.typename, nt.typecolor, bu.businessunit, " & _ "CASE " & _ " WHEN n.starttime <= NOW() AND (n.endtime IS NULL OR n.endtime >= NOW()) THEN 1 " & _ - " WHEN nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _ + " WHEN n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _ " ELSE 0 " & _ "END as is_current, " & _ "CASE " & _ - " WHEN nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _ + " WHEN n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _ " ELSE 0 " & _ "END as is_resolved, " & _ "CASE " & _ @@ -34,7 +34,7 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _ "LEFT JOIN businessunits bu ON n.businessunitid = bu.businessunitid " & _ "WHERE n.isshopfloor = 1 AND (" & _ " n.isactive = 1 OR " & _ - " (n.isactive = 0 AND nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND " & _ + " (n.isactive = 0 AND n.endtime IS NOT NULL AND " & _ " DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW())" & _ ")" diff --git a/displaynotifications.asp b/displaynotifications.asp index ac7e888..7ef8af9 100644 --- a/displaynotifications.asp +++ b/displaynotifications.asp @@ -65,10 +65,18 @@ <% Dim strSQL, rs - strSQL = "SELECT n.*, nt.typename, nt.typecolor, bu.businessunit " & _ + strSQL = "SELECT n.*, nt.typename, nt.typecolor, bu.businessunit, " & _ + "TIMESTAMPDIFF(MINUTE, n.endtime, NOW()) as minutes_since_end, " & _ + "CASE " & _ + " WHEN n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _ + " ELSE 0 " & _ + "END as is_complete " & _ "FROM notifications n " & _ "LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid " & _ "LEFT JOIN businessunits bu ON n.businessunitid = bu.businessunitid " & _ + "WHERE n.isactive = 1 OR " & _ + " (n.isactive = 0 AND n.endtime IS NOT NULL AND " & _ + " DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW()) " & _ "ORDER BY n.notificationid DESC" Set rs = objconn.Execute(strSQL) @@ -76,7 +84,7 @@ Response.Write("