removed old algorithm to calculate mosaicsFor

This commit is contained in:
Martin Folkerts 2024-07-04 21:18:08 +02:00
parent 1de6dd4edf
commit fe46be91a0

View file

@ -346,28 +346,6 @@ public function getFileDownloadsFor(Carbon $endDate, int $offset = 7): array
public function getMosaicsFor(Carbon $endDate, int $offset = 7): array
{
return collect(range(0, 3))
// ->map(function ($periodDiff) use ($endDate, $offset) {
// $calculatedEndDate = $endDate->clone();
// $calculatedOffset = (int) $endDate->clone()->previous($this->mail_day)->diffInDays($endDate);
// if ($calculatedOffset === 7) {
// $calculatedOffset = 1;
// }
// if ($periodDiff !== 0) {
// if ($calculatedOffset === 1) {
// for ($i = 1; $i < $periodDiff; $i++) {
// $calculatedEndDate->previous($this->mail_day);
// }
// } else {
// for ($i = 0; $i < $periodDiff; $i++) {
// $calculatedEndDate->previous($this->mail_day);
// }
// }
// $calculatedOffset = 7;
// $calculatedEndDate->subDay();
// }
//
// return ProjectMosiacGeneratorJob::handleFor($this, $calculatedEndDate, $calculatedOffset);
// })
->map(function() use ($endDate, $offset){
$currentEndDate = $endDate->clone();
if (!$currentEndDate->isDayOfWeek($this->mail_day)) {
@ -378,7 +356,6 @@ public function getMosaicsFor(Carbon $endDate, int $offset = 7): array
return ProjectMosiacGeneratorJob::handleFor($this, $currentEndDate, $calculatedOffSet);
})
->filter()
->toArray();
}