chore: remove temporary dynamic reprocess script
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Check token for security
|
||||
$expectedToken = '7f3b89e902a2cdb8b5de9f2e30f14d8a245fca9b';
|
||||
if (!isset($_GET['token']) || $_GET['token'] !== $expectedToken) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die('Forbidden: Invalid Token');
|
||||
}
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
echo "=========================================\n";
|
||||
echo "Reprocessing All May Attendance Records\n";
|
||||
echo "=========================================\n\n";
|
||||
|
||||
try {
|
||||
// Boot Laravel
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$kernel->bootstrap();
|
||||
|
||||
// 1. Find Paul Rei Paas
|
||||
$employee = \App\Models\Employee::where('biometric_emp_id', '2068')->first();
|
||||
if (!$employee) {
|
||||
throw new \Exception("Employee Paul Rei Paas (2068) not found.");
|
||||
}
|
||||
|
||||
$userId = $employee->user_id;
|
||||
echo "Employee: User ID $userId\n";
|
||||
|
||||
// Reprocess all records in March, April, and May 2026
|
||||
$records = \App\Models\AttendanceRecord::where('employee_id', $userId)
|
||||
->whereBetween('date', ['2026-03-01', '2026-05-31'])
|
||||
->get();
|
||||
|
||||
echo "Found " . $records->count() . " records.\n";
|
||||
|
||||
$updatedCount = 0;
|
||||
foreach ($records as $record) {
|
||||
$oldStatus = $record->status;
|
||||
$record->processAttendance();
|
||||
$newStatus = $record->status;
|
||||
if ($oldStatus !== $newStatus) {
|
||||
echo "Date: " . $record->date . " | Updated from $oldStatus to $newStatus\n";
|
||||
$updatedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
echo "\nCompleted. Updated $updatedCount records.\n";
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo "ERROR: " . $e->getMessage() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user