Fix Pint formatting
This commit is contained in:
+23
-16
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Homework extends BaseModel
|
||||
@@ -35,20 +34,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 */
|
||||
@@ -93,10 +92,18 @@ 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++;
|
||||
@@ -108,4 +115,4 @@ class Homework extends BaseModel
|
||||
|
||||
return round($total / $count, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user