Skip to content

Commit 7bd389f

Browse files
authored
fix: use correct CID and exclude abandon attempts for member theory exam page (#4675)
1 parent 5851fb4 commit 7bd389f

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

app/Filament/Training/Support/TheoryExamViewTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function theoryExamInfoList(): array
5454
Fieldset::make('Exam Information')
5555
->columnSpanFull()
5656
->schema([
57-
TextEntry::make('cid')->label('CID')->getStateUsing(fn ($record) => $record->student_id),
57+
TextEntry::make('cid')->label('CID')->getStateUsing(fn ($record) => $record->student?->account?->id),
5858

5959
TextEntry::make('Name')->label('Name')->getStateUsing(fn ($record) => $record->student?->account?->name ?? 'Unknown'),
6060

app/Repositories/Cts/TheoryExamResultRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function getTheoryExamHistoryQueryForLevels(Collection $examLevels): Buil
1515
{
1616
return TheoryResult::query()
1717
->with('student')
18-
->whereIn('exam', $examLevels);
18+
->whereIn('exam', $examLevels)
19+
->where('submitted', '1');
1920
}
2021
}

tests/Feature/TrainingPanel/Exams/TheoryExamHistoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ private function createTheoryExamData(): void
4646
'exam' => $level,
4747
'pass' => 1,
4848
'submitted_time' => now()->subDays(rand(1, 30)),
49+
'submitted' => 1,
4950
]);
5051

5152
$this->theoryResults[$level] = $theoryResult;

tests/Feature/TrainingPanel/MyTraining/MyExamHistoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ protected function setUp(): void
6666
'correct' => 2,
6767
'questions' => 2,
6868
'pass' => 1,
69+
'submitted' => 1,
6970
'submitted_time' => now()->subDays(10),
7071
]);
7172

@@ -221,6 +222,7 @@ public function it_only_shows_results_belonging_to_the_authenticated_member_on_t
221222
'correct' => 1,
222223
'questions' => 2,
223224
'pass' => 0,
225+
'submitted' => 1,
224226
]);
225227

226228
$component = Livewire::actingAs($this->studentAccount)
@@ -240,6 +242,7 @@ public function it_shows_multiple_results_when_member_has_sat_multiple_exams_on_
240242
'correct' => 2,
241243
'questions' => 2,
242244
'pass' => 1,
245+
'submitted' => 1,
243246
]);
244247

245248
$component = Livewire::actingAs($this->studentAccount)

0 commit comments

Comments
 (0)