[exam] add progress do update the same time

This commit is contained in:
xiaomlove
2021-04-27 02:44:44 +08:00
parent 465fd2bca8
commit d1b7561aae
17 changed files with 97 additions and 81 deletions
+3 -3
View File
@@ -22,13 +22,13 @@ class Exam extends NexusModel
];
const INDEX_UPLOADED = 1;
const INDEX_SEED_TIME_AVERGAGE = 2;
const INDEX_SEED_TIME_AVERAGE = 2;
const INDEX_DOWNLOADED = 3;
const INDEX_BONUS = 4;
public static $indexes = [
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB'],
self::INDEX_SEED_TIME_AVERGAGE => ['name' => 'Seed Time Average', 'unit' => 'Hour'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed Time Average', 'unit' => 'Hour'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB'],
self::INDEX_BONUS => ['name' => 'Bonus', 'unit' => ''],
];
@@ -41,7 +41,7 @@ class Exam extends NexusModel
self::FILTER_USER_REGISTER_TIME_RANGE => ['name' => 'User Register Time Range'],
];
public function getStatusTextAttribute()
public function getStatusTextAttribute(): string
{
return self::$status[$this->status]['text'] ?? '';
}
+2 -2
View File
@@ -4,7 +4,7 @@ namespace App\Models;
class ExamUser extends NexusModel
{
protected $fillable = ['exam_id', 'uid', 'status', 'result'];
protected $fillable = ['exam_id', 'uid', 'status', 'progress'];
public $timestamps = true;
@@ -17,7 +17,7 @@ class ExamUser extends NexusModel
];
protected $casts = [
'result' => 'json'
'progress' => 'json'
];
public function getStatusTextAttribute()
+1 -1
View File
@@ -11,7 +11,7 @@ class NexusModel extends Model
public $timestamps = false;
protected $perPage = 2;
// protected $perPage = 2;
/**
* 为数组 / JSON 序列化准备日期。
-2
View File
@@ -57,8 +57,6 @@ class User extends Authenticatable
self::CLASS_STAFF_LEADER => ['text' => 'Staff Leader'],
];
protected $perPage = 2;
public function getClassTextAttribute(): string
{
return self::$classes[$this->class]['text'] ?? '';