actingAsAdmin(); $round = $this->createRound(); $log = $this->createLog(['round_id' => $round->id]); $qsoA = $this->createLogQso([ 'log_id' => $log->id, 'qso_index' => 1, 'dx_call' => 'OK1AAA', ]); $qsoB = $this->createLogQso([ 'log_id' => $log->id, 'qso_index' => 2, 'dx_call' => 'OK1BBB', ]); $claimedRun = $this->createEvaluationRun([ 'round_id' => $round->id, 'rules_version' => 'CLAIMED', 'status' => 'SUCCEEDED', ]); $this->createQsoResult([ 'evaluation_run_id' => $claimedRun->id, 'log_qso_id' => $qsoA->id, 'error_code' => 'DUP', ]); $officialRun = $this->createEvaluationRun([ 'round_id' => $round->id, 'rules_version' => 'OFFICIAL', 'status' => 'SUCCEEDED', ]); $this->createQsoResult([ 'evaluation_run_id' => $officialRun->id, 'log_qso_id' => $qsoA->id, 'error_code' => 'OK', 'penalty_points' => 5, ]); $this->createQsoOverride([ 'evaluation_run_id' => $officialRun->id, 'log_qso_id' => $qsoB->id, 'forced_status' => 'AUTO', 'reason' => 'Manual override', ]); $response = $this->getJson("/api/logs/{$log->id}/qso-table"); $response->assertStatus(200) ->assertJsonFragment(['evaluation_run_id' => $officialRun->id]); $rows = collect($response->json('data')); $this->assertCount(2, $rows); $rowA = $rows->firstWhere('id', $qsoA->id); $rowB = $rows->firstWhere('id', $qsoB->id); $this->assertSame('OK1AAA', $rowA['dx_call']); $this->assertSame('OK', $rowA['result']['error_code']); $this->assertSame(5, $rowA['result']['penalty_points']); $this->assertNull($rowA['override']); $this->assertSame('OK1BBB', $rowB['dx_call']); $this->assertNull($rowB['result']); $this->assertSame('Manual override', $rowB['override']['reason']); } public function test_qso_table_respects_explicit_evaluation_run_id(): void { $this->actingAsAdmin(); $round = $this->createRound(); $log = $this->createLog(['round_id' => $round->id]); $qso = $this->createLogQso([ 'log_id' => $log->id, 'qso_index' => 1, ]); $claimedRun = $this->createEvaluationRun([ 'round_id' => $round->id, 'rules_version' => 'CLAIMED', 'status' => 'SUCCEEDED', ]); $this->createQsoResult([ 'evaluation_run_id' => $claimedRun->id, 'log_qso_id' => $qso->id, 'error_code' => 'DUP', ]); $officialRun = $this->createEvaluationRun([ 'round_id' => $round->id, 'rules_version' => 'OFFICIAL', 'status' => 'SUCCEEDED', ]); $this->createQsoResult([ 'evaluation_run_id' => $officialRun->id, 'log_qso_id' => $qso->id, 'error_code' => 'OK', ]); $response = $this->getJson("/api/logs/{$log->id}/qso-table?evaluation_run_id={$claimedRun->id}"); $response->assertStatus(200) ->assertJsonFragment(['evaluation_run_id' => $claimedRun->id]); $rows = collect($response->json('data')); $row = $rows->firstWhere('id', $qso->id); $this->assertSame('DUP', $row['result']['error_code']); } }