%
AI Contribution
%
Human Contribution
| Timestamp | Task | Project | Output Type | Duration |
|---|---|---|---|---|
| No activity logged yet. | ||||
Past timesheets will be shown here.
prepare("INSERT INTO activity_log (task, project, output_type, duration) VALUES (?, ?, ?, ?)"); $stmt->execute([$task, $project, $output_type, $duration]); header("Location: " . $_SERVER['PHP_SELF']); exit; } catch (PDOException $e) { error_log("DB Error: " . $e->getMessage()); } } } try { $pdo = db(); // Seed data if the table is empty $stmt = $pdo->query("SELECT COUNT(*) FROM activity_log"); if ($stmt->fetchColumn() == 0) { $seed_data = [ ['task' => 'Analyzed quarterly sales report for new market trends.', 'output_type' => 'AI', 'duration' => '00:02:35', 'project' => 'Q1 Sales Analysis'], ['task' => 'Verified data extraction accuracy from scanned invoices.', 'output_type' => 'Human', 'duration' => '00:05:10', 'project' => 'Invoice Processing'], ['task' => 'Generated Python script for automating data cleanup.', 'output_type' => 'AI', 'duration' => '00:03:50', 'project' => 'Data Migration Tool'], ]; $stmt = $pdo->prepare("INSERT INTO activity_log (task, output_type, duration, project) VALUES (?, ?, ?, ?)"); foreach ($seed_data as $row) { $stmt->execute([$row['task'], $row['output_type'], $row['duration'], $row['project']]); } } // Fetch data for the log $log_stmt = $pdo->query("SELECT *, DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as timestamp FROM activity_log ORDER BY created_at DESC"); $log_data = $log_stmt->fetchAll(); } catch (PDOException $e) { die("DB ERROR: " . $e->getMessage()); } // Calculate AI vs Human contribution $total_duration_ai = 0; $total_duration_human = 0; foreach ($log_data as $log) { list($h, $m, $s) = explode(':', $log['duration']); $duration_in_seconds = $h * 3600 + $m * 60 + $s; if ($log['output_type'] === 'AI') { $total_duration_ai += $duration_in_seconds; } else { $total_duration_human += $duration_in_seconds; } } $total_duration = $total_duration_ai + $total_duration_human; $ai_percentage = $total_duration > 0 ? round(($total_duration_ai / $total_duration) * 100) : 0; $human_percentage = $total_duration > 0 ? round(($total_duration_human / $total_duration) * 100) : 0; ?>
AI Contribution
Human Contribution
| Timestamp | Task | Project | Output Type | Duration |
|---|---|---|---|---|
| No activity logged yet. | ||||
Past timesheets will be shown here.