Skip to content

Commit 97f8508

Browse files
committed
Show better view of remaining points and days
1 parent c237e26 commit 97f8508

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

views/page-widgets/suggested-tasks.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,15 @@
6262
</div>
6363

6464
<?php if ( ! empty( $prpl_widget->get_previous_incomplete_months_badges() ) ) : ?>
65+
<?php
66+
$prpl_remaining_points = $prpl_widget->get_score()['target'] - $prpl_widget->get_score()['target_score'];
67+
$prpl_days_remaining = (int) \gmdate( 't' ) - (int) \gmdate( 'j' );
68+
?>
6569
<div class="prpl-previous-month-badge-progress-bars-wrapper">
6670
<h3><?php \esc_html_e( 'Oh no! You missed the previous monthly badge!', 'progress-planner' ); ?></h3>
6771
<p><?php echo \wp_kses( __( 'No worries though! <strong>Collect the surplus of points</strong> you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?></p>
6872
<?php foreach ( $prpl_widget->get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?>
73+
<?php $prpl_remaining_points += $prpl_previous_incomplete_month_badge->progress_callback()['remaining']; ?>
6974
<div
7075
class="prpl-previous-month-badge-progress-bar-wrapper"
7176
style="padding: 1rem 0; background-color: var(--prpl-background-orange); border-radius: 0.5rem; padding: 1rem;"
@@ -85,8 +90,9 @@ class="prpl-previous-month-badge-progress-bar-wrapper"
8590
<?php
8691
printf(
8792
/* translators: %d: The number of points. */
88-
\esc_html__( 'Only %d more points to go', 'progress-planner' ),
89-
(int) $prpl_previous_incomplete_month_badge->progress_callback()['remaining']
93+
\esc_html__( '%1$d more points to go in the next %2$d days', 'progress-planner' ),
94+
(int) $prpl_remaining_points,
95+
(int) $prpl_days_remaining
9096
);
9197
?>
9298
</span>

0 commit comments

Comments
 (0)