check double upload player event wip

This commit is contained in:
salam committed 2026-07-15 12:29:48 +02:00
1 parent 9954f47139
commit fd7b8fadad
7 files changed
+86 -91

No files matched your search

+13 -27
View File
@@ -9,12 +9,12 @@ use Spatie\SimpleExcel\SimpleExcelReader;
class ImportFixtures
{
public static function run(string $filePath, string $importmode): void
public static function run(string $filePath): void
{
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
SimpleExcelReader::create(storage_path('app/public/' . $filePath))
->getRows()
->chunk(200)
->each(function (LazyCollection $chunk) use ($importmode) {
->each(function (LazyCollection $chunk) {
foreach ($chunk as $row) {
@@ -30,30 +30,16 @@ class ImportFixtures
6 => 1.035168989838
*/
if ($importmode == 'update') {
StatisticFixtures::updateOrCreate(
[
'sport_id' => (int) $row[0],
'league_id' => (int) $row[1],
'home_id' => (int) $row[2],
'away_id' => (int) $row[3],
'starttime' => Carbon::parse($row[4])->toDateTimeString(),
],
['exp_home' => (float) $row[5], 'exp_away' => (float) $row[6]]
);
} else {
StatisticFixtures::insert(
[
'sport_id' => (int) $row[0],
'league_id' => (int) $row[1],
'home_id' => (int) $row[2],
'away_id' => (int) $row[3],
'starttime' => Carbon::parse($row[4])->toDateTimeString(),
'exp_home' => (float) $row[5],
'exp_away' => (float) $row[6],
]
);
}
StatisticFixtures::updateOrCreate(
[
'sport_id' => (int) $row[0],
'league_id' => (int) $row[1],
'home_id' => (int) $row[2],
'away_id' => (int) $row[3],
'starttime' => Carbon::parse($row[4])->toDateTimeString(),
],
['exp_home' => (float) $row[5], 'exp_away' => (float) $row[6]]
);
}
});
}