add rankOfEntry function to EntryService
This commit is contained in:
parent
8a2e0c589f
commit
0eebd541a0
|
|
@ -71,6 +71,6 @@ class AppServiceProvider extends ServiceProvider
|
||||||
User::observe(UserObserver::class);
|
User::observe(UserObserver::class);
|
||||||
SeatingLimit::observe(SeatingLimitObserver::class);
|
SeatingLimit::observe(SeatingLimitObserver::class);
|
||||||
|
|
||||||
#Model::preventLazyLoading(! app()->isProduction());
|
//Model::preventLazyLoading(! app()->isProduction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Actions\Tabulation\RankAuditionEntries;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
class EntryService
|
class EntryService
|
||||||
|
|
@ -33,4 +35,11 @@ class EntryService
|
||||||
|
|
||||||
return $allEntryIds->contains($entry->id);
|
return $allEntryIds->contains($entry->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function rankOfEntry(string $mode, Entry $entry)
|
||||||
|
{
|
||||||
|
$ranker = App::make(RankAuditionEntries::class);
|
||||||
|
$rankings = $ranker->rank($mode, $entry->audition);
|
||||||
|
return $rankings->find($entry->id)->rank;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue