This commit is contained in:
salam committed 2026-06-08 15:12:27 +02:00
1 parent 336af556a1
commit 8578ec96bb
6 files changed
+54 -71

No files matched your search

@@ -32,7 +32,11 @@ class Events
// to grap event id
// https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2022-05-19
// https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2026-05-31
// per event
// https://www.sofascore.com/api/v1/event/16198485/statistics
// https://www.sofascore.com/api/v1/event/16198485/odds/1/all
$years_back = 7;
$dates = Carbon::now()->subYears($years_back);
@@ -18,24 +18,32 @@ class Tournament
{
public static function load()
{
$days = 1;
$debug = Nuh::$options['d'] ?? 0;
$force = Nuh::$options['f'] ?? 0;
$sport_id = Nuh::$options['sport_id'];
$sport = Sport::where('id', $sport_id)->first();
$dates = Carbon::now();
// start yesterday
$grapping_date = Carbon::now()->subDay();
while ($dates >= Carbon::now()->subYears($sport->ss_grap_years)) {
$days++;
$days_back = Carbon::now()->subDays($days);
while ($grapping_date >= $days_back) {
$tournaments_counter = 0;
$day = $dates->format('Y-m-d');
$day = $grapping_date->format('Y-m-d');
/**
* grap only one time/sport check
*/
if (! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) {
if ($force || ! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) {
if ($debug) {
Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'g');
@@ -168,7 +176,7 @@ class Tournament
Notice::note('Having Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'b');
}
}
$dates->subDay();
$grapping_date->subDay();
}
}
}