Rewrite tabulation #14
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Actions\Tabulation;
|
||||
|
||||
use App\Models\Entry;
|
||||
|
||||
class AllJudgesCount implements CalculateEntryScore
|
||||
{
|
||||
public function calculate(string $mode, Entry $entry): array
|
||||
{
|
||||
return ['vinita'=>'hornets'];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Actions\Tabulation;
|
||||
|
||||
use App\Models\Entry;
|
||||
|
||||
interface CalculateEntryScore
|
||||
{
|
||||
public function __invoke($mode, $entry): array;
|
||||
public function calculate(string $mode, Entry $entry): array;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,21 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\AuditionService;
|
||||
use App\Services\Invoice\InvoiceDataService;
|
||||
use App\Services\TabulationService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Actions\Tabulation\CalculateEntryScore;
|
||||
use App\Models\Entry;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
protected $scoringGuideCacheService;
|
||||
protected $tabulationService;
|
||||
protected $invoiceService;
|
||||
|
||||
public function __construct(
|
||||
AuditionService $scoringGuideCacheService,
|
||||
TabulationService $tabulationService,
|
||||
InvoiceDataService $invoiceService
|
||||
) {
|
||||
$this->scoringGuideCacheService = $scoringGuideCacheService;
|
||||
$this->tabulationService = $tabulationService;
|
||||
$this->invoiceService = $invoiceService;
|
||||
protected CalculateEntryScore $bigCalc;
|
||||
public function __construct(CalculateEntryScore $bigCalc)
|
||||
{
|
||||
$this->bigCalc = $bigCalc;
|
||||
}
|
||||
|
||||
public function flashTest(Request $request)
|
||||
public function flashTest()
|
||||
{
|
||||
$lines = $this->invoiceService->getLines(12);
|
||||
$totalFees = $this->invoiceService->getGrandTotal(12);
|
||||
return view('test', compact('lines','totalFees'));
|
||||
$test = $this->bigCalc->calculate('seating', Entry::find(1127))['vinita'];
|
||||
|
||||
return view('test', compact('test'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Actions\Tabulation\AllJudgesCount;
|
||||
use App\Actions\Tabulation\CalculateEntryScore;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class CalculateEntryScoreProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(CalculateEntryScore::class, AllJudgesCount::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\CalculateEntryScoreProvider::class,
|
||||
App\Providers\FortifyServiceProvider::class,
|
||||
App\Providers\InvoiceDataServiceProvider::class,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -8,18 +8,8 @@
|
|||
<x-layout.app>
|
||||
<x-slot:page_title>Test Page</x-slot:page_title>
|
||||
@php
|
||||
$entry = Entry::find(1127);
|
||||
$judge = User::find(65);
|
||||
$scoreArray = [
|
||||
1 => 50,
|
||||
2 => 60,
|
||||
3 => 70,
|
||||
4 => 80,
|
||||
5 => 90,
|
||||
];
|
||||
enterScore($judge, $entry, $scoreArray);
|
||||
dump($entry->audition->name);
|
||||
@endphp
|
||||
|
||||
@endphp
|
||||
Test value: {{ $test }}
|
||||
|
||||
</x-layout.app>
|
||||
|
|
|
|||
Loading…
Reference in New Issue