fix gitlab tests
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class Participation extends BaseModel
|
||||
{
|
||||
protected $table = 'participation';
|
||||
@@ -31,19 +33,19 @@ class Participation extends BaseModel
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'student_id' => 'integer',
|
||||
'school_id' => 'integer',
|
||||
'student_id' => 'integer',
|
||||
'school_id' => 'integer',
|
||||
'class_section_id' => 'integer',
|
||||
'updated_by' => 'integer',
|
||||
'updated_by' => 'integer',
|
||||
|
||||
// score is numeric; change to 'integer' if it is whole number
|
||||
'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 */
|
||||
@@ -78,25 +80,15 @@ class Participation extends BaseModel
|
||||
}
|
||||
|
||||
$row = $q->first();
|
||||
if (! $row) {
|
||||
return null;
|
||||
}
|
||||
if (!$row) return null;
|
||||
|
||||
$score = $row->score;
|
||||
|
||||
if ($score === null) {
|
||||
return null;
|
||||
}
|
||||
if (is_string($score) && trim($score) === '') {
|
||||
return null;
|
||||
}
|
||||
if ($score === '') {
|
||||
return null;
|
||||
}
|
||||
if (! is_numeric($score)) {
|
||||
return null;
|
||||
}
|
||||
if ($score === null) return null;
|
||||
if (is_string($score) && trim($score) === '') return null;
|
||||
if ($score === '') return null;
|
||||
if (!is_numeric($score)) return null;
|
||||
|
||||
return (float) $score;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user