exam index seed bonus => seed points

This commit is contained in:
xiaomlove
2022-02-20 21:50:03 +08:00
parent 27c7bd47f8
commit 3a357f1534
7 changed files with 25 additions and 19 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class Exam extends NexusModel
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'],
self::INDEX_SEED_BONUS => ['name' => 'Seed bonus', 'unit' => '', 'source_user_field' => 'seed_points'],
self::INDEX_SEED_BONUS => ['name' => 'Seed points', 'unit' => '', 'source_user_field' => 'seed_points'],
];
const FILTER_USER_CLASS = 'classes';
+1 -1
View File
@@ -482,7 +482,7 @@ class ExamRepository extends BaseRepository
$attributes['index'] = $index['index'];
$attributes['created_at'] = $now;
$attributes['updated_at'] = $now;
$attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']};
$attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']} ?? 0;
do_log("[GET_TOTAL_VALUE]: " . $attributes['value']);
$newVersionProgress = ExamProgress::query()
->where('exam_user_id', $examUser->id)