Skip to content

Commit

Permalink
fix: user should wait a day to continue the challenge condition exper…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
hamoda-dev authored and muhammadmp97 committed Apr 2, 2024
1 parent 7162836 commit d11d7e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Challenge/ContinueChallengeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function execute(Challenge $challenge): Challenge
throw new HttpException(400, 'This challenge is not ongoing!');
}

if ($challenge->continued_at->diffInDays() === 0) {
if ($challenge->continued_at->diffInDays() < 1) {
throw new HttpException(400, 'Not a day has passed yet!');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ContinueChallengeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function test_user_continues_the_challenge()
->assertStatus(200);

$challenge = Challenge::first();
$this->assertTrue($challenge->continued_at->diffInDays() === 0);
$this->assertTrue($challenge->continued_at->diffInDays() < 1);
$this->assertTrue($challenge->updated_at->diffInDays() > 0);
}

Expand Down

0 comments on commit d11d7e9

Please sign in to comment.