Skip to content

Commit

Permalink
use already existing helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ilicfilip committed Nov 14, 2024
1 parent b14dfe4 commit ee8d6db
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions classes/class-suggested-tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,15 @@ public function mark_task_as_completed( $task_id ) {
$activity->save();

// Clear monthly saved progress.
$badge_id = 'monthly-' . $activity_date->format( 'Y' ) . '-m' . $activity_date->format( 'm' );
$badge_id = 'monthly-' . $activity_date->format( 'Y' ) . '-m' . $activity_date->format( 'm' );
$monthly_badge = \progress_planner()->get_badges()->get_badge( $badge_id );

foreach ( \progress_planner()->get_badges()->get_badges( 'monthly' ) as $badge ) {
if ( $monthly_badge ) {
// Clear the progress.
$monthly_badge->clear_progress();

if ( $badge_id === $badge->get_id() ) {

// Clear the progress.
$badge->clear_progress();

// Save the progress.
$badge->get_progress();
break;
}
// Save the progress.
$monthly_badge->get_progress();
}

$this->mark_task_as_pending_celebration( $task_id );
Expand Down

0 comments on commit ee8d6db

Please sign in to comment.