recreate project

This commit is contained in:
root
2026-02-10 22:11:06 -05:00
commit 663c0cdbda
10149 changed files with 1379710 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class SemesterScoreModel extends Model
{
protected $table = 'semester_scores';
protected $primaryKey = 'id';
protected $allowedFields = [
'student_id',
'school_id',
'class_section_id',
'updated_by',
'homework_avg',
'quiz_avg',
'project_avg',
'midterm_exam_score',
'final_exam_score',
'attendance_score',
'participation_score',
'ptap_score',
'test_avg',
'semester_score',
'semester',
'school_year'
];
/**
* Insert or update a semester score record
*/
// In SemesterScoreModel.php
public function upsert(array $data): bool
{
// First check if record exists
$existing = $this->where([
'student_id' => $data['student_id'],
'semester' => $data['semester'],
'school_year' => $data['school_year']
])->first();
// If exists - UPDATE
if ($existing) {
return $this->update($existing['id'], $data);
}
// If new - INSERT
else {
return $this->insert($data) !== false;
}
}
}