fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
@@ -10,8 +10,7 @@ class AttendanceNotificationLogService
{
public function __construct(
protected ParentNotification $notificationModel
) {
}
) {}
public function notificationAlreadySent(
int $studentId,
@@ -31,13 +30,14 @@ class AttendanceNotificationLogService
->where('incident_date', $ymd)
->where('channel', $channel);
if (!empty($to)) {
if (! empty($to)) {
$query->where('to_address', $to);
}
return $query->exists();
} catch (Throwable $e) {
Log::debug('notificationAlreadySent(): ' . $e->getMessage());
Log::debug('notificationAlreadySent(): '.$e->getMessage());
return false;
}
}
@@ -61,37 +61,37 @@ class AttendanceNotificationLogService
->whereDate('incident_date', $ymd)
->where('channel', $channel);
if (!empty($to)) {
if (! empty($to)) {
$existingQuery->where('to_address', $to);
}
$existing = $existingQuery->orderByDesc('id')->first();
if ($existing && !empty($existing->id)) {
if ($existing && ! empty($existing->id)) {
$existing->update([
'subject' => $subject,
'status' => $status,
'response' => $response,
'semester' => $semester,
'school_year' => $schoolYear,
'updated_at' => now(),
'subject' => $subject,
'status' => $status,
'response' => $response,
'semester' => $semester,
'school_year' => $schoolYear,
'updated_at' => now(),
]);
} else {
$this->notificationModel->query()->create([
'student_id' => $studentId,
'code' => $code,
'student_id' => $studentId,
'code' => $code,
'incident_date' => $ymd,
'channel' => $channel,
'to_address' => $to,
'subject' => $subject,
'status' => $status,
'response' => $response,
'semester' => $semester,
'school_year' => $schoolYear,
'channel' => $channel,
'to_address' => $to,
'subject' => $subject,
'status' => $status,
'response' => $response,
'semester' => $semester,
'school_year' => $schoolYear,
]);
}
} catch (Throwable $e) {
Log::debug('logNotification(): ' . $e->getMessage());
Log::debug('logNotification(): '.$e->getMessage());
}
}
}