fix initial+refresher
This commit is contained in:
@@ -19,6 +19,7 @@ if (!$__trWidgetHr) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only the most recent record per (employee, topic) — older history rows ignored. */
|
||||
$__trRows = $pdo->query("
|
||||
SELECT et.id,
|
||||
et.next_due_date,
|
||||
@@ -27,6 +28,13 @@ $__trRows = $pdo->query("
|
||||
FROM employee_trainings et
|
||||
JOIN training_topics tt ON tt.id = et.training_topic_id
|
||||
WHERE et.next_due_date IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM employee_trainings et2
|
||||
WHERE et2.employee_id = et.employee_id
|
||||
AND et2.training_topic_id = et.training_topic_id
|
||||
AND (et2.completed_date > et.completed_date
|
||||
OR (et2.completed_date = et.completed_date AND et2.id > et.id))
|
||||
)
|
||||
")->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$__expiredCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user