Fix debug notifications not being sent
All checks were successful
Push image to registry / build-image (push) Successful in 4m16s

This commit is contained in:
2025-03-19 18:15:06 +01:00
parent e8b9517664
commit af96f996ee

View File

@@ -2,6 +2,7 @@
namespace App\Browser\Jobs\HellcaseBattles; namespace App\Browser\Jobs\HellcaseBattles;
use App\Browser\JobDebugScreenshot;
use App\Browser\Jobs\Hellcase\HellcaseJob; use App\Browser\Jobs\Hellcase\HellcaseJob;
use App\Models\HellcaseBattle; use App\Models\HellcaseBattle;
use App\Models\Job; use App\Models\Job;
@@ -70,13 +71,12 @@ class HellcaseBattlesJob extends HellcaseJob implements ShouldBeUniqueUntilProce
$browser->visit('https://hellcase.com/casebattle'); $browser->visit('https://hellcase.com/casebattle');
$browser->waitForText("CASES", 30, true); $browser->waitForText("CASES", 30, true);
AllNotification::send(new JobDebugNotification($this->jobId, "I hate niggers"));
// Sort by price // Sort by price
try { try {
$sortByPriceDiv = $browser->driver->findElement(WebDriverBy::xpath("//*[span[contains(text(), 'Value')]]")); $sortByPriceDiv = $browser->driver->findElement(WebDriverBy::xpath("//*[span[contains(text(), 'Value')]]"));
$sortByPriceDiv->click(); $sortByPriceDiv->click();
} catch (Exception $e) { } catch (Exception $e) {
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to sort by price")); AllNotification::send(new JobDebugNotification($this->jobId, "Failed to sort by price"));
return; return;
} }
@@ -112,9 +112,7 @@ class HellcaseBattlesJob extends HellcaseJob implements ShouldBeUniqueUntilProce
private function sendFinishedBattles(Browser $browser) { private function sendFinishedBattles(Browser $browser) {
// foreach battle that we didn"t already planned to add with $this->battlesToAdd // foreach battle that we didn"t already planned to add with $this->battlesToAdd
foreach (HellcaseBattle::all() as $battle) { foreach (HellcaseBattle::all() as $battle) {
dump($battle);
if (!array_key_exists($battle->getUrl(), $this->battlesToAdd)) { if (!array_key_exists($battle->getUrl(), $this->battlesToAdd)) {
dump("finished");
$browser->visit($battle->getUrl()); $browser->visit($battle->getUrl());
try { try {
@@ -130,7 +128,7 @@ class HellcaseBattlesJob extends HellcaseJob implements ShouldBeUniqueUntilProce
} }
private function sendBattle(Browser $browser, HellcaseBattle $battle) { private function sendBattle(Browser $browser, HellcaseBattle $battle) {
AllNotification::send(new JobDebugNotification($this->jobId, "Battle sent" . $battle->getUrl())); AllNotification::send(new JobDebugNotification($this->jobId, "Battle sent" . $battle->getUrl(), screenshotProjectPath:null));
} }
private function createNewBattles() { private function createNewBattles() {