fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
+16 -23
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Support\Facades\DB;
class Homework extends BaseModel
@@ -34,20 +35,20 @@ class Homework extends BaseModel
];
protected $casts = [
'student_id' => 'integer',
'school_id' => 'integer',
'student_id' => 'integer',
'school_id' => 'integer',
'class_section_id' => 'integer',
'updated_by' => 'integer',
'homework_index' => 'integer',
'updated_by' => 'integer',
'homework_index' => 'integer',
// keep numeric; change to 'integer' if your scores are whole numbers
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'score' => 'decimal:2',
'max_points' => 'decimal:2',
'locked_by' => 'integer',
'locked_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/* Optional relationships */
@@ -92,18 +93,10 @@ class Homework extends BaseModel
foreach ($rows as $r) {
$score = $r->score ?? null;
if ($score === null) {
continue;
}
if (is_string($score) && trim($score) === '') {
continue;
}
if ($score === '') {
continue;
}
if (! is_numeric($score)) {
continue;
}
if ($score === null) continue;
if (is_string($score) && trim($score) === '') continue;
if ($score === '') continue;
if (!is_numeric($score)) continue;
$total += (float) $score;
$count++;
@@ -115,4 +108,4 @@ class Homework extends BaseModel
return round($total / $count, 2);
}
}
}