feat: add utility scripts to automate internship journal review, approval, and summary generation processes

This commit is contained in:
Ümit Tunç
2026-08-07 23:14:20 +03:00
parent 9b719324cd
commit 9b91b3c847
10 changed files with 1435 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$weekStart = '2026-08-03';
$weekEnd = '2026-08-07';
$interns = App\Models\CareerApplication::where('type', 'internship')
->with(['journalEntries' => function($q) {
$q->orderBy('date', 'asc');
}])->get();
echo "=== BU HAFTA (03.08.2026 - 07.08.2026) STAJYER KODLAMA DURUMU ===\n\n";
$noCodingActiveInterns = [];
$activeInternsWithCoding = [];
$inactiveInterns = [];
foreach ($interns as $intern) {
// Check if internship is active in this date range
$start = $intern->internship_start_date;
$end = $intern->internship_end_date;
// An intern is active this week if internship started on or before Friday 2026-08-07, and ends on or after Monday 2026-08-03
$isActiveThisWeek = ($start <= $weekEnd && $end >= $weekStart);
// Filter entries for this week
$thisWeekEntries = [];
foreach ($intern->journalEntries as $entry) {
if ($entry->date >= $weekStart && $entry->date <= $weekEnd) {
if (!empty(trim($entry->content))) {
$thisWeekEntries[] = $entry;
}
}
}
$internData = [
'id' => $intern->id,
'name' => $intern->name,
'email' => $intern->email,
'start_date' => $start,
'end_date' => $end,
'is_active' => $isActiveThisWeek,
'this_week_entry_count' => count($thisWeekEntries),
'this_week_dates' => array_map(fn($e) => $e->date, $thisWeekEntries),
'all_entries_count' => $intern->journalEntries->where('content', '!=', '')->count(),
];
if (!$isActiveThisWeek) {
$inactiveInterns[] = $internData;
} else {
if (count($thisWeekEntries) == 0) {
$noCodingActiveInterns[] = $internData;
} else {
$activeInternsWithCoding[] = $internData;
}
}
}
echo "1. STAJ GÜNÜ AKTİF OLUP BU HAFTA HİÇ KODLAMA / DEFTEN GİRİŞİ YAPMAYANLAR:\n";
foreach ($noCodingActiveInterns as $i) {
echo "• " . $i['name'] . " (" . $i['email'] . ")\n";
echo " - Staj Tarihleri: " . $i['start_date'] . " - " . $i['end_date'] . "\n";
echo " - Bu Hafta Doldurulan Gün Sayısı: 0\n";
echo " - Toplam (Tüm Staj Boyunca) Giriş Sayısı: " . $i['all_entries_count'] . "\n\n";
}
echo "2. STAJ GÜNÜ AKTİF OLUP BU HAFTA KODLAMA / DEFTEN GİRİŞİ YAPANLAR:\n";
foreach ($activeInternsWithCoding as $i) {
echo "• " . $i['name'] . " (" . $i['email'] . ")\n";
echo " - Staj Tarihleri: " . $i['start_date'] . " - " . $i['end_date'] . "\n";
echo " - Bu Hafta Doldurulan Gün Sayısı: " . $i['this_week_entry_count'] . " / 5 gün (Tarihler: " . implode(', ', $i['this_week_dates']) . ")\n\n";
}
echo "3. BU HAFTA STAJ DÖNEMİ DIŞINDA / PASİF OLANLAR:\n";
foreach ($inactiveInterns as $i) {
echo "• " . $i['name'] . " (" . $i['email'] . ") [Tarihler: " . $i['start_date'] . " - " . $i['end_date'] . "]\n";
}