Skip to content

Commit

Permalink
Refactor the code
Browse files Browse the repository at this point in the history
CS-5957
  • Loading branch information
MarijaIv committed Oct 15, 2024
1 parent 6383e04 commit d521cf2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Services/BusinessLogic/StatisticalDataService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ public function saveStatisticalData(StatisticalData $statisticalData): void
{
$this->statisticalDataRepository->setStatisticalData($statisticalData);

if ($statisticalData->isSendStatisticalData()) {
if ($this->timeProvider->getCurrentLocalTime()->getTimestamp() <= strtotime(self::SCHEDULE_TIME)) {
$sendReport = new SendReport(strtotime(self::SCHEDULE_TIME));
} else {
$sendReport = new SendReport(strtotime(self::SCHEDULE_TIME_NEXT_DAY));
}

$this->sendReportRepository->setSendReport(
$sendReport
);
if (!$statisticalData->isSendStatisticalData()) {
return;
}

if ($this->timeProvider->getCurrentLocalTime()->getTimestamp() <= strtotime(self::SCHEDULE_TIME)) {
$sendReport = new SendReport(strtotime(self::SCHEDULE_TIME));
} else {
$sendReport = new SendReport(strtotime(self::SCHEDULE_TIME_NEXT_DAY));
}

$this->sendReportRepository->setSendReport(
$sendReport
);
}

/**
Expand Down

0 comments on commit d521cf2

Please sign in to comment.