Skip to content

Commit

Permalink
Merge pull request #276 from wri/feat/TM-939-update-report-timing
Browse files Browse the repository at this point in the history
[TM-939] Update timing of PPC report generation.
  • Loading branch information
roguenet authored Jun 11, 2024
2 parents 83ef414 + 39aa118 commit de3fac6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@ protected function schedule(Schedule $schedule)
$schedule->command('generate-control-site-due-submissions')->weeklyOn(5, '00:00');

// PPC report jobs
$schedule->job(new CreateTaskDueJob('ppc', 4))->yearlyOn(1, 7);

$schedule->job(new CreateTaskDueJob('ppc', 7))->yearlyOn(3, 15);

$schedule->job(new CreateTaskDueJob('ppc', 10))->yearlyOn(7, 7);

$schedule->job(new CreateTaskDueJob('ppc', 1))->yearlyOn(10, 6);
$schedule->job(new CreateTaskDueJob('ppc', 4, 4))->yearlyOn(3, 14);
$schedule->job(new CreateTaskDueJob('ppc', 7, 5))->yearlyOn(6, 14);
$schedule->job(new CreateTaskDueJob('ppc', 10, 4))->yearlyOn(9, 13);
$schedule->job(new CreateTaskDueJob('ppc', 1, 3))->yearlyOn(12, 13);

// Terrafund report jobs
$schedule->job(new CreateTaskDueJob('terrafund'))->yearlyOn(12, 31);

$schedule->job(new CreateTaskDueJob('terrafund'))->yearlyOn(6, 30);

$schedule->job(new SendReportRemindersJob('terrafund'))->yearlyOn(5, 30);
Expand Down
4 changes: 2 additions & 2 deletions app/Jobs/V2/CreateTaskDueJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class CreateTaskDueJob implements ShouldQueue

private $frameworkKey;

public function __construct(string $frameworkKey, int $dueMonth = null)
public function __construct(string $frameworkKey, int $dueMonth = null, int $dueDay = null)
{
$this->frameworkKey = $frameworkKey;

if ($dueMonth) {
$carbonDate = Carbon::createFromFormat('m', $dueMonth)->startOfMonth()->setDay(5);
$carbonDate = Carbon::createFromFormat('m', $dueMonth)->startOfMonth()->setDay($dueDay ?? 5);
$this->dueDate = $carbonDate->isPast() ? $carbonDate->addYear() : $carbonDate;
} else {
$this->dueDate = Carbon::now()->addMonth()->startOfDay();
Expand Down

0 comments on commit de3fac6

Please sign in to comment.