]> git.localhorst.tv Git - alttp.git/commitdiff
actually save tfl title lol master
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 19 Jun 2026 13:29:08 +0000 (15:29 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 19 Jun 2026 13:29:08 +0000 (15:29 +0200)
app/Console/Commands/SyncTFL.php

index c294740f7afe6257d9666ce25dfe1d98351fab88..33f948ef0c7e1362896dc332160702e951b53ef6 100644 (file)
@@ -93,7 +93,12 @@ class SyncTFL extends Command {
                        $episode->ext_id = $ext_id;
                        $episode->event()->associate($event);
                }
                        $episode->ext_id = $ext_id;
                        $episode->event()->associate($event);
                }
-               $episode->title = $tflEntry['name'];
+               $title_matches = preg_match('/^(.*) \\| ([^|]+) vs\\. ([^|]+) \\| (.*)$/', $tflEntry['name'], $matches);
+               if ($title_matches) {
+                       $episode->title = $matches[1].' - '.$matches[4];
+               } else {
+                       $episode->title = $tflEntry['name'];
+               }
                $start = Carbon::createFromFormat('Y-m-d\\T H:i:sP', $tflEntry['start']);
                if (!$episode->start || $start->ne($episode->start)) {
                        $episode->start = $start;
                $start = Carbon::createFromFormat('Y-m-d\\T H:i:sP', $tflEntry['start']);
                if (!$episode->start || $start->ne($episode->start)) {
                        $episode->start = $start;
@@ -102,10 +107,9 @@ class SyncTFL extends Command {
                $episode->confirmed = true;
                $episode->save();
 
                $episode->confirmed = true;
                $episode->save();
 
-               if (!preg_match('/^(.*) \\| ([^|]+) vs\\. ([^|]+) \\| (.*)$/', $tflEntry['name'], $matches)) {
+               if (!$title_matches) {
                        return;
                }
                        return;
                }
-               $episode->title = $matches[1].' - '.$matches[4];
                $tflPlayers = [$matches[2], $matches[3]];
 
                $this->purgePlayers($episode, $tflPlayers);
                $tflPlayers = [$matches[2], $matches[3]];
 
                $this->purgePlayers($episode, $tflPlayers);