Skip to content

Commit

Permalink
fixes a bug where it creates two rules for weekly repetitions instead…
Browse files Browse the repository at this point in the history
… of one
  • Loading branch information
mohammedmanssour committed May 13, 2023
1 parent 6171123 commit ab2f17f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Support/PendingRepeats/PendingEveryWeekRepeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ private function getRule(string $day): array
return $rules[0];
}

public function __destruct()
{
$this->rules();
}

private function weekdays()
{
return ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
Expand Down
2 changes: 2 additions & 0 deletions tests/RepeatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public function it_creates_weekly_repetition()
->repeat()
->weekly();

$this->assertEquals(1, $this->task()->repetitions()->count());

$this->assertDatabaseHas('repetitions', [
'start_at' => $this->task()->repetitionBaseDate()->addDay(),
'type' => 'complex',
Expand Down

0 comments on commit ab2f17f

Please sign in to comment.