exam add index SEED_POINTS + UPLOAD_TORRENT_COUNT

This commit is contained in:
xiaomlove
2023-11-08 03:17:23 +08:00
parent a85c2d3658
commit d9c449d00a
8 changed files with 52 additions and 17 deletions
+5 -1
View File
@@ -36,12 +36,16 @@ class Exam extends NexusModel
const INDEX_SEED_TIME_AVERAGE = 2;
const INDEX_DOWNLOADED = 3;
const INDEX_SEED_BONUS = 4;
const INDEX_SEED_POINTS = 5;
const INDEX_UPLOAD_TORRENT_COUNT = 6;
public static $indexes = [
public static array $indexes = [
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'],
self::INDEX_SEED_BONUS => ['name' => 'Bonus', 'unit' => '', 'source_user_field' => 'seedbonus'],
self::INDEX_SEED_POINTS => ['name' => 'Seed points', 'unit' => '', 'source_user_field' => ''],
self::INDEX_UPLOAD_TORRENT_COUNT => ['name' => 'Upload torrent', 'unit' => '', 'source_user_field' => ''],
];
const FILTER_USER_CLASS = 'classes';
+5
View File
@@ -488,6 +488,11 @@ class Torrent extends NexusModel
$query->where('visible', $visible);
}
public function scopeNormal($query)
{
$query->where('visible', self::VISIBLE_YES)->where('banned', self::BANNED_NO);
}
public function torrent_tags(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(TorrentTag::class, 'torrent_id');
+1 -1
View File
@@ -223,7 +223,7 @@ class User extends Authenticatable implements FilamentUser, HasName
'uploaded', 'downloaded', 'seedbonus', 'seedtime', 'leechtime',
'invited_by', 'enabled', 'seed_points', 'last_access', 'invites',
'lang', 'attendance_card', 'privacy', 'noad', 'downloadpos', 'donoruntil', 'donor',
'seedbonus', 'bonuscomment', 'downloadpos', 'vip_added', 'vip_until', 'title', 'invites', 'attendance_card',
'bonuscomment', 'downloadpos', 'vip_added', 'vip_until', 'title', 'invites', 'attendance_card',
'seed_points_per_hour'
];