add tests batch 20
This commit is contained in:
@@ -9,7 +9,9 @@ class HomeworkTrackingService
|
||||
{
|
||||
private array $teacherAssignmentCache = [];
|
||||
|
||||
public function __construct(private HomeworkTrackingCalendarService $calendarService) {}
|
||||
public function __construct(private HomeworkTrackingCalendarService $calendarService)
|
||||
{
|
||||
}
|
||||
|
||||
public function report(?string $semester = null, ?string $schoolYear = null, int $page = 1): array
|
||||
{
|
||||
@@ -120,7 +122,7 @@ class HomeworkTrackingService
|
||||
$date = substr((string) ($row->hw_date ?? ''), 0, 10);
|
||||
$cnt = (int) $row->cnt;
|
||||
$firstCreated = substr((string) ($row->first_created ?? ''), 0, 10);
|
||||
if ($csid <= 0 || ! $date || $cnt <= 0) {
|
||||
if ($csid <= 0 || !$date || $cnt <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -136,7 +138,7 @@ class HomeworkTrackingService
|
||||
}
|
||||
|
||||
$j = $baseIndex;
|
||||
while ($j >= 0 && ! empty($eventDays[$sundays[$j]])) {
|
||||
while ($j >= 0 && !empty($eventDays[$sundays[$j]])) {
|
||||
$j--;
|
||||
}
|
||||
if ($j < 0) {
|
||||
@@ -175,7 +177,7 @@ class HomeworkTrackingService
|
||||
if ($sid <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (! isset($bySection[$sid])) {
|
||||
if (!isset($bySection[$sid])) {
|
||||
$bySection[$sid] = [
|
||||
'class_section_id' => $sid,
|
||||
'class_id' => (int) ($row->class_id ?? 0),
|
||||
@@ -184,7 +186,7 @@ class HomeworkTrackingService
|
||||
'tas' => [],
|
||||
];
|
||||
}
|
||||
$name = trim((string) ($row->firstname ?? '').' '.(string) ($row->lastname ?? ''));
|
||||
$name = trim((string) ($row->firstname ?? '') . ' ' . (string) ($row->lastname ?? ''));
|
||||
$pos = strtolower((string) ($row->position ?? ''));
|
||||
if ($name !== '') {
|
||||
if ($pos === 'main') {
|
||||
@@ -200,23 +202,15 @@ class HomeworkTrackingService
|
||||
$ai = (int) ($a['class_id'] ?? 0);
|
||||
$bi = (int) ($b['class_id'] ?? 0);
|
||||
$order = function (int $cid): int {
|
||||
if ($cid === 13) {
|
||||
return 0;
|
||||
}
|
||||
if ($cid >= 1 && $cid <= 11) {
|
||||
return $cid;
|
||||
}
|
||||
if ($cid === 12) {
|
||||
return 99;
|
||||
}
|
||||
|
||||
if ($cid === 13) return 0;
|
||||
if ($cid >= 1 && $cid <= 11) return $cid;
|
||||
if ($cid === 12) return 99;
|
||||
return 200 + $cid;
|
||||
};
|
||||
$cmp = $order($ai) <=> $order($bi);
|
||||
if ($cmp !== 0) {
|
||||
return $cmp;
|
||||
}
|
||||
|
||||
return strnatcasecmp($a['class_section_name'] ?? '', $b['class_section_name'] ?? '');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user