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"; }