Cleanup TODOs in project
This commit is contained in:
parent
3033ef41c8
commit
7c55b35c40
|
|
@ -11,7 +11,6 @@ use function abort;
|
|||
|
||||
class EntryController extends Controller
|
||||
{
|
||||
// TODO authorization policies
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
|
@ -31,7 +30,6 @@ class EntryController extends Controller
|
|||
if ($request->user()->cannot('create', Entry::class)) {
|
||||
abort(403);
|
||||
}
|
||||
// TODO write custom rule to verify the combination of student and audition is unique
|
||||
$validData = $request->validate([
|
||||
'student_id' => ['required', 'exists:students,id'],
|
||||
'audition_id' => ['required', 'exists:auditions,id'],
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Audition;
|
||||
use App\Models\School;
|
||||
use App\Models\Student;
|
||||
use App\Rules\UniqueFullNameAtSchool;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -12,7 +11,6 @@ use Illuminate\Support\Facades\Auth;
|
|||
use function abort;
|
||||
use function redirect;
|
||||
|
||||
// TODO validation rules to make sure a student name is unique at a school
|
||||
class StudentController extends Controller
|
||||
{
|
||||
/**
|
||||
|
|
@ -106,8 +104,6 @@ class StudentController extends Controller
|
|||
'grade' => request('grade'),
|
||||
]);
|
||||
|
||||
// TODO if a students grade is changed, we need to be sure they are still eligible for the auditions in which they are entered.
|
||||
|
||||
return redirect('/students')->with('success', 'Student updated successfully.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ class UserController extends Controller
|
|||
'school_id' => request('school_id'),
|
||||
]);
|
||||
|
||||
// TODO we probably don't want to go here if done from an admin page
|
||||
return redirect('/my_school');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ class ScoreSheet extends Model
|
|||
|
||||
public function isValid()
|
||||
{
|
||||
// TODO move to either TabulationService or a specific service for scoreValidation
|
||||
$judges = $this->audition->judges;
|
||||
|
||||
return $judges->contains('id', $this->judge->id);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class ScoringGuide extends Model
|
|||
*/
|
||||
public function validateScores(array $prospective_score)
|
||||
{
|
||||
// TODO move to either TabulationService or a specific service for scoreValidation
|
||||
foreach ($this->subscores as $subscore) {
|
||||
if (! array_key_exists($subscore->id, $prospective_score)) {
|
||||
return 'A score must be provided for '.$subscore->name;
|
||||
|
|
@ -55,6 +54,5 @@ class ScoringGuide extends Model
|
|||
}
|
||||
|
||||
return 'success';
|
||||
// TODO this probably needs to be rewritten as a validation rule
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,13 +160,11 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||
|
||||
public function scoresForEntry($entry)
|
||||
{
|
||||
// TODO Again, why is this here? Needs to go somewhere else. Maybe a Judging service
|
||||
return $this->scoreSheets->where('entry_id', '=', $entry)->first()?->subscores;
|
||||
}
|
||||
|
||||
public function timeForEntryScores($entry)
|
||||
{
|
||||
// TODO Why is this in the User mode? Move it somewhere else
|
||||
return $this->scoreSheets->where('entry_id', '=', $entry)->first()?->created_at;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ it('grants access to tabulators', function () {
|
|||
// Act & Assert
|
||||
get($this->r)->assertOk();
|
||||
});
|
||||
// TODO make tests with varied information
|
||||
it('returns the audition object and an array of info on each entry', function () {
|
||||
// Arrange
|
||||
$entry = Entry::factory()->create(['audition_id' => $this->audition->id]);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
||||
<?php
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
|
||||
use App\Models\Audition;
|
||||
use App\Models\Ensemble;
|
||||
|
|
@ -72,7 +74,6 @@ it('shows a delete option for ensembles with no students seated', function () {
|
|||
$response = get((route('admin.ensembles.index')));
|
||||
$response->assertOk();
|
||||
$response->assertSee(route('admin.ensembles.destroy', $noSeatsEnsemble), false);
|
||||
//$response->assertDontSee(route('admin.ensembles.destroy', $seatsEnsemble), false); // TODO figure out how to test for a delete form that does not also see an edit form
|
||||
});
|
||||
it('allows an administrator to delete an ensemble while no entries are seated', function () {
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Sinnbeck\DomAssertions\Asserts\AssertForm;
|
||||
|
||||
use Sinnbeck\DomAssertions\Asserts\AssertSelect;
|
||||
|
||||
use function Pest\Laravel\get;
|
||||
use function Pest\Laravel\post;
|
||||
|
||||
|
|
@ -67,11 +67,11 @@ it('has a field with forms for each audition setting', function () {
|
|||
])
|
||||
->containsInput([
|
||||
'name' => 'late_fee',
|
||||
'value' => number_format(auditionSetting('late_fee')/100, 2),
|
||||
'value' => number_format(auditionSetting('late_fee') / 100, 2),
|
||||
])
|
||||
->containsInput([
|
||||
'name' => 'school_fee',
|
||||
'value' => number_format(auditionSetting('school_fee')/100, 2),
|
||||
'value' => number_format(auditionSetting('school_fee') / 100, 2),
|
||||
])
|
||||
->containsInput([
|
||||
'name' => 'payment_address',
|
||||
|
|
@ -93,21 +93,19 @@ it('has a field with forms for each audition setting', function () {
|
|||
->containsInput([
|
||||
'name' => 'olympic_scoring',
|
||||
'type' => 'checkbox',
|
||||
// TODO how can I test if it is checked when necessary
|
||||
])
|
||||
->containsInput([
|
||||
'name' => 'judging_enabled',
|
||||
'type' => 'checkbox',
|
||||
// TODO how can I test if it is checked when necessary
|
||||
])
|
||||
->findSelect('#fee_structure', function(AssertSelect $select) {
|
||||
->findSelect('#fee_structure', function (AssertSelect $select) {
|
||||
$select->containsOption([
|
||||
'value' => 'oneFeePerEntry',
|
||||
'text'=> 'One fee per entry',
|
||||
'text' => 'One fee per entry',
|
||||
])
|
||||
->containsOption([
|
||||
'value' => 'oneFeePerStudent',
|
||||
'text' => 'One fee per student - one late fee per student if any of their entries are late',
|
||||
'value' => 'oneFeePerStudent',
|
||||
'text' => 'One fee per student - one late fee per student if any of their entries are late',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
@ -128,7 +126,7 @@ it('can update audition settings', function () {
|
|||
'payment_city' => 'New City',
|
||||
'payment_state' => 'NS',
|
||||
'payment_zip' => 12345,
|
||||
'fee_structure' => 'oneFeePerEntry'
|
||||
'fee_structure' => 'oneFeePerEntry',
|
||||
];
|
||||
// Act
|
||||
$response = post(route('audition-settings-save'), $newData);
|
||||
|
|
|
|||
Loading…
Reference in New Issue