fix logic and tests, update docker CI file
This commit is contained in:
@@ -55,21 +55,17 @@ class AttendanceNotificationLogService
|
||||
?string $schoolYear = null
|
||||
): void {
|
||||
try {
|
||||
$where = [
|
||||
'student_id' => $studentId,
|
||||
'code' => $code,
|
||||
'incident_date' => $ymd,
|
||||
'channel' => $channel,
|
||||
];
|
||||
$existingQuery = $this->notificationModel->query()
|
||||
->where('student_id', $studentId)
|
||||
->where('code', $code)
|
||||
->whereDate('incident_date', $ymd)
|
||||
->where('channel', $channel);
|
||||
|
||||
if (!empty($to)) {
|
||||
$where['to_address'] = $to;
|
||||
$existingQuery->where('to_address', $to);
|
||||
}
|
||||
|
||||
$existing = $this->notificationModel->query()
|
||||
->where($where)
|
||||
->orderByDesc('id')
|
||||
->first();
|
||||
$existing = $existingQuery->orderByDesc('id')->first();
|
||||
|
||||
if ($existing && !empty($existing->id)) {
|
||||
$existing->update([
|
||||
@@ -98,4 +94,4 @@ class AttendanceNotificationLogService
|
||||
Log::debug('logNotification(): ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user