From ebd768e767ff920a7b83ba5a1a6c205817bdf61b Mon Sep 17 00:00:00 2001
From: Brian Miyaji
Date: Thu, 8 Jun 2017 19:46:32 +1000
Subject: [PATCH] Enable average-based timed career totals
---
.../class-sp-meta-box-player-statistics.php | 41 ++++++++-----------
.../class-sp-meta-box-statistic-details.php | 4 +-
includes/class-sp-player.php | 40 ++----------------
includes/sp-formatting-functions.php | 21 ++++++++++
4 files changed, 45 insertions(+), 61 deletions(-)
diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
index 04069632..f2fe1b29 100644
--- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
+++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
@@ -121,10 +121,23 @@ class SP_Meta_Box_Player_Statistics {
| ';
+ } else {
+ if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
+ echo '';
+ echo '';
+ } else {
+ echo '';
+ }
+ }
?> |
@@ -196,26 +209,8 @@ class SP_Meta_Box_Player_Statistics {
// Convert value and placeholder to time format
if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
-
- // Convert value
- $intval = intval( $value );
- $timeval = gmdate( 'i:s', $intval );
- $hours = floor( $intval / 3600 );
-
- if ( '00' != $hours )
- $timeval = $hours . ':' . $timeval;
-
- $timeval = preg_replace( '/^0/', '', $timeval );
-
- // Convert placeholder
- $intval = intval( $placeholder );
- $placeholder = gmdate( 'i:s', $intval );
- $hours = floor( $intval / 3600 );
-
- if ( '00' != $hours )
- $placeholder = $hours . ':' . $placeholder;
-
- $placeholder = preg_replace( '/^0/', '', $placeholder );
+ $timeval = sp_time_value( $value );
+ $placeholder = sp_time_value( $placeholder );
}
if ( $readonly ) {
diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php
index d87199c3..4f8cc4da 100644
--- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php
+++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php
@@ -66,11 +66,11 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
?>
-
+