Make sure rank cache is cleared when making a doubler decision.
This commit is contained in:
parent
bac4000253
commit
fd07254e3e
|
|
@ -5,6 +5,7 @@ namespace App\Actions\Entries;
|
||||||
use App\Exceptions\AuditionAdminException;
|
use App\Exceptions\AuditionAdminException;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use App\Services\DoublerService;
|
use App\Services\DoublerService;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
class DoublerDecision
|
class DoublerDecision
|
||||||
{
|
{
|
||||||
|
|
@ -42,9 +43,10 @@ class DoublerDecision
|
||||||
|
|
||||||
public function accept($entry): void
|
public function accept($entry): void
|
||||||
{
|
{
|
||||||
// Decline all other entries
|
// Decline all other entries and clear rank cache
|
||||||
$doublerInfo = $this->doublerService->simpleDoubleInfo($entry);
|
$doublerInfo = $this->doublerService->simpleDoubleInfo($entry);
|
||||||
foreach ($doublerInfo as $doublerEntry) {
|
foreach ($doublerInfo as $doublerEntry) {
|
||||||
|
Cache::forget('audition'.$doublerEntry->audition_id.'seating');
|
||||||
/** @var Entry $doublerEntry */
|
/** @var Entry $doublerEntry */
|
||||||
if ($doublerEntry->id !== $entry->id) {
|
if ($doublerEntry->id !== $entry->id) {
|
||||||
$doublerEntry->addFlag('declined');
|
$doublerEntry->addFlag('declined');
|
||||||
|
|
@ -60,7 +62,7 @@ class DoublerDecision
|
||||||
if ($entry->hasFlag('declined')) {
|
if ($entry->hasFlag('declined')) {
|
||||||
throw new AuditionAdminException('Entry is already declined');
|
throw new AuditionAdminException('Entry is already declined');
|
||||||
}
|
}
|
||||||
|
Cache::forget('audition'.$entry->audition_id.'seating');
|
||||||
$entry->addFlag('declined');
|
$entry->addFlag('declined');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue