fix gitlab tests
This commit is contained in:
@@ -10,7 +10,8 @@ class WhatsappInviteService
|
||||
private WhatsappContextService $context,
|
||||
private WhatsappInviteBundleService $bundleService,
|
||||
private WhatsappInviteNotificationService $notificationService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function send(array $payload): array
|
||||
{
|
||||
@@ -24,7 +25,7 @@ class WhatsappInviteService
|
||||
$linkBySection = [];
|
||||
foreach ($links as $link) {
|
||||
$cid = (int) ($link->class_section_id ?? 0);
|
||||
if ($cid && ! isset($linkBySection[$cid])) {
|
||||
if ($cid && !isset($linkBySection[$cid])) {
|
||||
$linkBySection[$cid] = $link->toArray();
|
||||
}
|
||||
}
|
||||
@@ -37,7 +38,7 @@ class WhatsappInviteService
|
||||
continue;
|
||||
}
|
||||
$bundle = $this->bundleService->bundleForParent($pickedId, $linkBySection, $schoolYear, $semester);
|
||||
if ($bundle && ! empty($bundle['emails']) && ! empty($bundle['links'])) {
|
||||
if ($bundle && !empty($bundle['emails']) && !empty($bundle['links'])) {
|
||||
$bundles[] = $bundle;
|
||||
}
|
||||
}
|
||||
@@ -45,14 +46,14 @@ class WhatsappInviteService
|
||||
$classSectionId = (int) ($payload['class_section_id'] ?? 0);
|
||||
$classBundles = $this->bundleService->bundlesForClass($classSectionId, $linkBySection, $schoolYear, $semester);
|
||||
foreach ($classBundles as $bundle) {
|
||||
if (! empty($bundle['emails']) && ! empty($bundle['links'])) {
|
||||
if (!empty($bundle['emails']) && !empty($bundle['links'])) {
|
||||
$bundles[] = $bundle;
|
||||
}
|
||||
}
|
||||
} elseif ($mode === 'all') {
|
||||
$allBundles = $this->bundleService->bundlesForAll($linkBySection, $schoolYear, $semester);
|
||||
foreach ($allBundles as $bundle) {
|
||||
if (! empty($bundle['emails']) && ! empty($bundle['links'])) {
|
||||
if (!empty($bundle['emails']) && !empty($bundle['links'])) {
|
||||
$bundles[] = $bundle;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ class WhatsappInviteService
|
||||
$consolidated = $this->bundleService->consolidateBundles($bundles);
|
||||
$result = $this->notificationService->dispatch($consolidated, $schoolYear, $semester);
|
||||
|
||||
if (! ($result['ok'] ?? false)) {
|
||||
if (!($result['ok'] ?? false)) {
|
||||
return $result + ['ok' => false];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user