<?php
// Script to fix the syntax error in the marksheet correctly

$file_path = 'reports/all_subjects_marksheet.php';
$content = file_get_contents($file_path);

// Fix the CQ section syntax error - add missing closing brace
$cq_pattern = 'echo implode\(\', \', \$individual_marks\) \. \' \(গড়: \' \. floor\(\$avg_cq\) \. \'\)\'\; else \{';
$cq_replacement = 'echo implode(\', \', $individual_marks) . \' (গড়: \' . floor($avg_cq) . \')\';' . "\n                            } else {";
$content = preg_replace("/{$cq_pattern}/", $cq_replacement, $content);

// Fix the MCQ section syntax error - add missing closing brace
$mcq_pattern = 'echo implode\(\', \', \$individual_marks\) \. \' \(গড়: \' \. floor\(\$avg_mcq\) \. \'\)\'\; else \{';
$mcq_replacement = 'echo implode(\', \', $individual_marks) . \' (গড়: \' . floor($avg_mcq) . \')\';' . "\n                            } else {";
$content = preg_replace("/{$mcq_pattern}/", $mcq_replacement, $content);

file_put_contents($file_path, $content);
echo "Syntax error fixed successfully!\n";
?>