add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
@@ -14,10 +14,9 @@ class StickerPresetService
];
return array_map(static function (array $row): array {
$row['title'] = $row['title'] ?? ($row['label'] ?? ($row['value'].' mm'));
$row['title'] = $row['title'] ?? ($row['label'] ?? ($row['value'] . ' mm'));
$row['text'] = $row['text'] ?? $row['title'];
$row['per_page'] = $row['per_page'] ?? ($row['ppg'] ?? null);
return $row;
}, $rows);
}
@@ -6,7 +6,9 @@ use Illuminate\Support\Facades\Log;
class StickerPrintService
{
public function __construct(private StickerQueryService $queryService) {}
public function __construct(private StickerQueryService $queryService)
{
}
public function generate(array $payload): array
{
@@ -21,7 +23,7 @@ class StickerPrintService
if ($studentId > 0) {
$student = $this->queryService->findStudent($studentId);
if (! $student) {
if (!$student) {
return ['ok' => false, 'message' => 'Student not found.'];
}
$students = [$student];
@@ -100,7 +102,7 @@ class StickerPrintService
$minPt = 8;
$hPad = 2;
$fullName = trim(($student['firstname'] ?? '').' '.($student['lastname'] ?? '')) ?: 'Student';
$fullName = trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? '')) ?: 'Student';
$bestPt = $maxPt;
$textW = 0.0;
@@ -156,7 +158,6 @@ class StickerPrintService
for ($k = 0; $k < $qty; $k++) {
$printList[] = $students[0];
}
return $printList;
}
@@ -220,19 +221,19 @@ class StickerPrintService
|| (abs($stickerWidth - 100.0) < 0.6 && abs($stickerHeight - 24.5) < 0.6);
if ($isXSmallPreset) {
if (! $marginLeftProvided) {
if (!$marginLeftProvided) {
$marginLeft = 4.0;
if (! $marginRightProvided) {
if (!$marginRightProvided) {
$marginRight = 4.0;
}
}
if (! $marginRightProvided && $marginRight < 4.0) {
if (!$marginRightProvided && $marginRight < 4.0) {
$marginRight = 4.0;
}
if (! $gapXProvided) {
if (!$gapXProvided) {
$gapX = 0.0;
}
if (! $gapYProvided) {
if (!$gapYProvided) {
$gapY = 0.0;
}
}
@@ -6,7 +6,9 @@ use Illuminate\Support\Facades\DB;
class StickerQueryService
{
public function __construct(private StickerContextService $context) {}
public function __construct(private StickerContextService $context)
{
}
public function resolveSchoolYear(?string $schoolYear): string
{
@@ -106,8 +108,7 @@ class StickerQueryService
if ($sectionName === '') {
return false;
}
return ! preg_match('/^(youth|kg)(?:\b|-)/i', $sectionName);
return !preg_match('/^(youth|kg)(?:\b|-)/i', $sectionName);
}));
}
}