|
|
|
|
@ -166,16 +166,50 @@ class AdminApplicationExportTest extends TestCase
|
|
|
|
|
$this->assertGreaterThanOrEqual(2, count($rows));
|
|
|
|
|
$header = $rows[0];
|
|
|
|
|
$this->assertContains('进程', $header);
|
|
|
|
|
$this->assertContains('总分', $header);
|
|
|
|
|
$this->assertContains('平均分', $header);
|
|
|
|
|
$this->assertContains('评分详情', $header);
|
|
|
|
|
|
|
|
|
|
$progressIdx = array_search('进程', $header, true);
|
|
|
|
|
$totalIdx = array_search('总分', $header, true);
|
|
|
|
|
$avgIdx = array_search('平均分', $header, true);
|
|
|
|
|
$detailIdx = array_search('评分详情', $header, true);
|
|
|
|
|
$this->assertNotFalse($progressIdx);
|
|
|
|
|
$this->assertNotFalse($totalIdx);
|
|
|
|
|
$this->assertNotFalse($avgIdx);
|
|
|
|
|
$this->assertNotFalse($detailIdx);
|
|
|
|
|
|
|
|
|
|
$data = $rows[1];
|
|
|
|
|
$this->assertSame('1/2', (string) $data[$progressIdx]);
|
|
|
|
|
$this->assertSame('待评审', (string) $data[$totalIdx]);
|
|
|
|
|
$this->assertSame('-', (string) $data[$avgIdx]);
|
|
|
|
|
$this->assertStringContainsString('评委甲 88.5', (string) $data[$detailIdx]);
|
|
|
|
|
$this->assertStringContainsString('评委乙 未评审', (string) $data[$detailIdx]);
|
|
|
|
|
|
|
|
|
|
ApplicationReviewScore::query()->create([
|
|
|
|
|
'application_id' => $application->id,
|
|
|
|
|
'reviewer_id' => $reviewer2->id,
|
|
|
|
|
'payload_json' => ['line_total' => 91.5],
|
|
|
|
|
'line_total' => 91.5,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$xlsxPath2 = $service->buildXlsxExportPath($competition, ['status' => 'submitted']);
|
|
|
|
|
$this->assertFileExists($xlsxPath2);
|
|
|
|
|
$reader2 = new Reader;
|
|
|
|
|
$reader2->open($xlsxPath2);
|
|
|
|
|
$rows2 = [];
|
|
|
|
|
foreach ($reader2->getSheetIterator() as $sheet) {
|
|
|
|
|
foreach ($sheet->getRowIterator() as $row) {
|
|
|
|
|
$rows2[] = $row->toArray();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$reader2->close();
|
|
|
|
|
@unlink($xlsxPath2);
|
|
|
|
|
|
|
|
|
|
$data2 = $rows2[1];
|
|
|
|
|
$this->assertSame('2/2', (string) $data2[$progressIdx]);
|
|
|
|
|
$this->assertSame('180', (string) $data2[$totalIdx]);
|
|
|
|
|
$this->assertSame('90', (string) $data2[$avgIdx]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|