Rewrite tabulation #14

Merged
okorpheus merged 43 commits from rewrite-tabulation into master 2024-07-14 05:36:29 +00:00
6 changed files with 55 additions and 34 deletions
Showing only changes of commit 529542d1ba - Show all commits

View File

@ -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'];
}
}

View File

@ -2,7 +2,9 @@
namespace App\Actions\Tabulation; namespace App\Actions\Tabulation;
use App\Models\Entry;
interface CalculateEntryScore interface CalculateEntryScore
{ {
public function __invoke($mode, $entry): array; public function calculate(string $mode, Entry $entry): array;
} }

View File

@ -2,32 +2,21 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Services\AuditionService; use App\Actions\Tabulation\CalculateEntryScore;
use App\Services\Invoice\InvoiceDataService; use App\Models\Entry;
use App\Services\TabulationService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
class TestController extends Controller class TestController extends Controller
{ {
protected $scoringGuideCacheService; protected CalculateEntryScore $bigCalc;
protected $tabulationService; public function __construct(CalculateEntryScore $bigCalc)
protected $invoiceService; {
$this->bigCalc = $bigCalc;
public function __construct(
AuditionService $scoringGuideCacheService,
TabulationService $tabulationService,
InvoiceDataService $invoiceService
) {
$this->scoringGuideCacheService = $scoringGuideCacheService;
$this->tabulationService = $tabulationService;
$this->invoiceService = $invoiceService;
} }
public function flashTest(Request $request) public function flashTest()
{ {
$lines = $this->invoiceService->getLines(12); $test = $this->bigCalc->calculate('seating', Entry::find(1127))['vinita'];
$totalFees = $this->invoiceService->getGrandTotal(12);
return view('test', compact('lines','totalFees')); return view('test', compact('test'));
} }
} }

View File

@ -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
{
//
}
}

View File

@ -2,6 +2,7 @@
return [ return [
App\Providers\AppServiceProvider::class, App\Providers\AppServiceProvider::class,
App\Providers\CalculateEntryScoreProvider::class,
App\Providers\FortifyServiceProvider::class, App\Providers\FortifyServiceProvider::class,
App\Providers\InvoiceDataServiceProvider::class, App\Providers\InvoiceDataServiceProvider::class,
]; ];

View File

@ -8,18 +8,8 @@
<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
$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> </x-layout.app>