This commit is contained in:
salam committed 2026-10-13 12:25:40 +02:00
1 parent 8ade164b9d
commit 03737bc540
1 file changed
+32 -23
+32 -23
View File
@@ -132,6 +132,8 @@ trait GrappingSofascore
$this->speed = $this->ask_speed(); $this->speed = $this->ask_speed();
$daily_way = $this->select_daily_days();
if ($this->ask_settings_download()) { if ($this->ask_settings_download()) {
$this->settings_to_local(); $this->settings_to_local();
} }
@@ -154,28 +156,8 @@ trait GrappingSofascore
/** /**
* day 1 * day 1
*/ */
// $day = Carbon::now()->subDay()->format('Y-m-d'); if (in_array($daily_way, [1, 3])) {
$day = Carbon::now()->subDay()->format('Y-m-d');
// $res = SofaScoreTaskDay::where('grapper_id', (int) $this->task_id)->where('day', $day)->first();
// if (! $res) {
// $this->grapped_files = $this->get_tree($this->data_dir . '/' . $day);
// $this->grap_tournaments_for_day($day);
// foreach ($this->tournaments_requested as $tournament) {
// $this->get_event($day, $tournament);
// }
// SofaScoreTaskDay::updateOrCreate(['grapper_id' => (int) $this->task_id, 'day' => $day], ['done' => 1]);
// }
/**
* day 5
*/
$day = Carbon::now()->subDays(5)->format('Y-m-d');
$res = SofaScoreTaskDay::where('grapper_id', (int) $this->task_id)->where('day', $day)->first();
if (! $res) {
$this->grapped_files = $this->get_tree($this->data_dir . '/' . $day); $this->grapped_files = $this->get_tree($this->data_dir . '/' . $day);
@@ -184,9 +166,23 @@ trait GrappingSofascore
foreach ($this->tournaments_requested as $tournament) { foreach ($this->tournaments_requested as $tournament) {
$this->get_event($day, $tournament); $this->get_event($day, $tournament);
} }
SofaScoreTaskDay::updateOrCreate(['grapper_id' => (int) $this->task_id, 'day' => $day], ['done' => 1]); SofaScoreTaskDay::updateOrCreate(['grapper_id' => (int) $this->task_id, 'day' => $day], ['done' => 1]);
} }
/**
* day 5
*/
if (in_array($daily_way, [2, 3])) {
$day = Carbon::now()->subDays(5)->format('Y-m-d');
$this->grapped_files = $this->get_tree($this->data_dir . '/' . $day);
$this->grap_tournaments_for_day($day);
foreach ($this->tournaments_requested as $tournament) {
$this->get_event($day, $tournament);
}
}
/** /**
* to excel day by day * to excel day by day
*/ */
@@ -340,6 +336,19 @@ trait GrappingSofascore
); );
} }
protected function select_daily_days(): string
{
return select(
label: 'What days should be grapped?',
scroll: 10,
options: [
1 => 'Day 1',
2 => 'Day 2',
3 => 'Day 1 & 2',
]
);
}
protected function select_day(): string protected function select_day(): string
{ {
return text( return text(