Skip to content

Commit 248ab90

Browse files
committed
Fix(🛠) : Total min and total second calculation.
1 parent ec01781 commit 248ab90

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

classes/Course.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3305,8 +3305,8 @@ public static function get_total_course_duration( $course_ids ): array {
33053305
}
33063306

33073307
$hours = floor( $total_seconds / 3600 );
3308-
$minutes = floor( ( $total_seconds % 3600 ) / 60 );
3309-
$seconds = $total_seconds % 60;
3308+
$minutes = floor( $total_seconds / 60 );
3309+
$seconds = $total_seconds;
33103310

33113311
return array(
33123312
'hours' => (int) $hours,

templates/dashboard/student-dashboard.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757

5858
$time_spent = Course::get_total_course_duration( $completed_courses );
5959
$grid_col = $time_spent['hours'] > 0 ? 'tutor-grid-cols-4' : 'tutor-grid-cols-3';
60-
$seconds = $time_spent['minutes'] > 0 ? $time_spent['minutes'] * 60 : 0;
6160
?>
6261
<div class="tutor-grid tutor-sm-grid-cols-2 tutor-gap-5 tutor-mb-7 <?php echo esc_attr( $grid_col ); ?>">
6362
<div class="tutor-card tutor-stat-card tutor-stat-card-enrolled">
@@ -181,19 +180,20 @@ class="tutor-card tutor-stat-card tutor-stat-card-time-spent"
181180
</span>
182181
<?php endif; ?>
183182

184-
<?php if ( $seconds > 0 ) : ?>
183+
<?php if ( $time_spent['seconds'] > 0 ) : ?>
185184
<span class="tutor-font-medium">
186185
<?php
187186
echo esc_html(
188187
sprintf(
189188
/* translators: 1: total seconds spent */
190189
__( ', and %1$d+ seconds!', 'tutor' ),
191-
$seconds
190+
$time_spent['seconds']
192191
)
193192
);
194193
?>
195194
</span>
196195
<?php endif; ?>
196+
<br>
197197
<?php echo esc_html__( 'Incredible!', 'tutor' ); ?>
198198
</p>
199199

0 commit comments

Comments
 (0)