feat: add utility scripts to automate internship journal review, approval, and summary generation processes
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
|
||||
$interns = App\Models\CareerApplication::where('type', 'internship')->where('status', 'accepted')->with(['journalEntries' => function($q) {
|
||||
$q->orderBy('day_number', 'asc');
|
||||
}])->get();
|
||||
|
||||
$analysis = [];
|
||||
|
||||
foreach ($interns as $intern) {
|
||||
if ($intern->journalEntries->count() == 0) continue;
|
||||
|
||||
$repoUrl = $intern->github_repo;
|
||||
$allContent = "";
|
||||
$commits = [];
|
||||
|
||||
foreach ($intern->journalEntries as $entry) {
|
||||
$allContent .= "\n--- DAY {$entry->day_number} ({$entry->date}) ---\n" . $entry->content . "\n";
|
||||
|
||||
// Extract commits from content if available
|
||||
if (preg_match_all('/\[[0-9:]+\]\s*\[([a-f0-9]+)\]\s*(.+)/i', $entry->content, $matches, PREG_SET_ORDER)) {
|
||||
foreach ($matches as $m) {
|
||||
$commits[] = [
|
||||
'hash' => $m[1],
|
||||
'msg' => $m[2],
|
||||
'day' => $entry->day_number
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$analysis[$intern->name] = [
|
||||
'id' => $intern->id,
|
||||
'email' => $intern->email,
|
||||
'repo' => $repoUrl,
|
||||
'github_username' => $intern->github_username,
|
||||
'total_entries' => $intern->journalEntries->count(),
|
||||
'commits_count' => count($commits),
|
||||
'commits_sample' => array_slice($commits, -10),
|
||||
'full_text' => $allContent
|
||||
];
|
||||
}
|
||||
|
||||
file_put_contents(__DIR__ . '/repo_analysis_data.json', json_encode($analysis, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
echo "Saved analysis data for " . count($analysis) . " interns.\n";
|
||||
Reference in New Issue
Block a user