Acceptance limits show on seating page
This commit is contained in:
parent
be108c0827
commit
55b6081fc6
|
|
@ -32,6 +32,7 @@ use App\Services\AuditionCacheService;
|
||||||
use App\Services\DoublerService;
|
use App\Services\DoublerService;
|
||||||
use App\Services\EntryCacheService;
|
use App\Services\EntryCacheService;
|
||||||
use App\Services\ScoreService;
|
use App\Services\ScoreService;
|
||||||
|
use App\Services\SeatingService;
|
||||||
use App\Services\TabulationService;
|
use App\Services\TabulationService;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
@ -47,6 +48,10 @@ class AppServiceProvider extends ServiceProvider
|
||||||
return new AuditionCacheService();
|
return new AuditionCacheService();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->app->singleton(SeatingService::class, function () {
|
||||||
|
return new SeatingService();
|
||||||
|
});
|
||||||
|
|
||||||
$this->app->singleton(EntryCacheService::class, function($app) {
|
$this->app->singleton(EntryCacheService::class, function($app) {
|
||||||
return new EntryCacheService($app->make(AuditionCacheService::class));
|
return new EntryCacheService($app->make(AuditionCacheService::class));
|
||||||
});
|
});
|
||||||
|
|
@ -62,10 +67,8 @@ class AppServiceProvider extends ServiceProvider
|
||||||
$app->make(EntryCacheService::class));
|
$app->make(EntryCacheService::class));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->app->singleton(DoublerService::class, function($app) {
|
$this->app->singleton(DoublerService::class, function($app) {
|
||||||
return new DoublerService($app->make(AuditionCacheService::class),$app->make(TabulationService::class));
|
return new DoublerService($app->make(AuditionCacheService::class),$app->make(TabulationService::class),$app->make(SeatingService::class));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,15 @@ class DoublerService
|
||||||
protected $doublersCacheKey = 'doublers';
|
protected $doublersCacheKey = 'doublers';
|
||||||
protected $auditionCacheService;
|
protected $auditionCacheService;
|
||||||
protected $tabulationService;
|
protected $tabulationService;
|
||||||
|
protected $seatingService;
|
||||||
/**
|
/**
|
||||||
* Create a new class instance.
|
* Create a new class instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(AuditionCacheService $auditionCacheService, TabulationService $tabulationService)
|
public function __construct(AuditionCacheService $auditionCacheService, TabulationService $tabulationService, SeatingService $seatingService)
|
||||||
{
|
{
|
||||||
$this->auditionCacheService = $auditionCacheService;
|
$this->auditionCacheService = $auditionCacheService;
|
||||||
$this->tabulationService = $tabulationService;
|
$this->tabulationService = $tabulationService;
|
||||||
|
$this->seatingService = $seatingService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,7 +62,8 @@ class DoublerService
|
||||||
'auditionID' => $entry->audition_id,
|
'auditionID' => $entry->audition_id,
|
||||||
'auditionName' => $this->auditionCacheService->getAudition($entry->audition_id)->name,
|
'auditionName' => $this->auditionCacheService->getAudition($entry->audition_id)->name,
|
||||||
'rank' => $this->tabulationService->entryRank($entry),
|
'rank' => $this->tabulationService->entryRank($entry),
|
||||||
'unscored' => $this->tabulationService->remainingEntriesForAudition($entry->audition_id)
|
'unscored' => $this->tabulationService->remainingEntriesForAudition($entry->audition_id),
|
||||||
|
'limits' => $this->seatingService->getLimitForAudition($entry->audition_id),
|
||||||
];
|
];
|
||||||
$entry->audition = $this->auditionCacheService->getAudition($entry->audition_id);
|
$entry->audition = $this->auditionCacheService->getAudition($entry->audition_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\SeatingLimit;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use function Pest\Laravel\get;
|
||||||
|
|
||||||
|
class SeatingService
|
||||||
|
{
|
||||||
|
protected $limitsCacheKey = 'acceptanceLimits';
|
||||||
|
/**
|
||||||
|
* Create a new class instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAcceptanceLimits()
|
||||||
|
{
|
||||||
|
// TODO modifying audition limits should refresh this cache
|
||||||
|
return Cache::remember($this->limitsCacheKey, now()->addDay(), function () {
|
||||||
|
return SeatingLimit::all()->groupBy('audition_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLimitForAudition($auditionId)
|
||||||
|
{
|
||||||
|
return $this->getAcceptanceLimits()[$auditionId];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refershLimits() {
|
||||||
|
Cache::forget($this->limitsCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,11 @@
|
||||||
<p class="truncate">{{ $info['unscored'] }} Unscored</p>
|
<p class="truncate">{{ $info['unscored'] }} Unscored</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1 flex items-center gap-x-2 text-xs leading-5 text-gray-500">
|
<div class="mt-1 flex items-center gap-x-2 text-xs leading-5 text-gray-500">
|
||||||
Acceptance Limits
|
<ul>
|
||||||
|
@foreach($info['limits'] as $limit)
|
||||||
|
<li>{{ $limit->ensemble->name }} accepts {{ $limit->maximum_accepted }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@
|
||||||
@inject('scoreservice','App\Services\ScoreService');
|
@inject('scoreservice','App\Services\ScoreService');
|
||||||
@inject('auditionService','App\Services\AuditionCacheService');
|
@inject('auditionService','App\Services\AuditionCacheService');
|
||||||
@inject('entryService','App\Services\EntryCacheService')
|
@inject('entryService','App\Services\EntryCacheService')
|
||||||
|
@inject('seatingService','App\Services\SeatingService')
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>Test Page</x-slot:page_title>
|
<x-slot:page_title>Test Page</x-slot:page_title>
|
||||||
@php
|
@php
|
||||||
dump($scoreservice->getScoringGuide(58)->subscores_count);
|
dump($seatingService->getLimitForAudition(47));
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue