Score Entry working for tabulator

This commit is contained in:
Matt Young 2024-07-08 17:16:36 -05:00
parent d58b95e995
commit af837264e9
3 changed files with 21 additions and 3 deletions

View File

@ -4,9 +4,9 @@ namespace App\Http\Controllers\Tabulation;
use App\Http\Controllers\Controller;
use App\Models\Entry;
use App\Models\ScoreSheet;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use App\Models\ScoreSheet;
class ScoreController extends Controller
{
@ -48,7 +48,10 @@ class ScoreController extends Controller
if (! $entry) {
return redirect()->route('tabulation.chooseEntry')->with('error', 'Entry not found');
}
session()->flash('error', 'This entry is marked as a no-show. Entering a score will remove the no-show flag');
if ($entry->hasFlag('no_show')) {
session()->flash('error',
'This entry is marked as a no-show. Entering a score will remove the no-show flag');
}
return view('tabulation.entry_score_sheet',
compact('entry', 'judges', 'scoring_guide', 'subscores', 'existing_sheets'));

View File

@ -38,6 +38,11 @@ class ScoreSheet extends Model
);
}
public function getSubscore($id)
{
return $this->subscores[$id]['score'] ?? false;
}
public function isValid()
{
// TODO move to either TabulationService or a specific service for scoreValidation

View File

@ -103,9 +103,19 @@ it('will not accept scores for an entry in an audition with published advancemen
});
it('warns if the entry is flagged as a no-show', function () {
// Arrange
$response = validRequest();
$data = testData();
$data['entry']->addFlag('no_show');
$response = validRequest($data);
// Act & Assert
$response
->assertOk()
->assertSee('marked as a no-show');
});
it('does not show the no-show flag if an entry is not a no show', function () {
// Arrange
$response = validRequest();
// Act & Assert
$response
->assertOk()
->assertDontSee('marked as a no-show');
});