Calculate sum/average statistics, delete duplicate configs, sort player list by number

This commit is contained in:
Brian Miyaji
2014-01-25 05:42:33 +11:00
parent a4aa963755
commit 8db2a05fa3
7 changed files with 177 additions and 81 deletions

View File

@@ -75,6 +75,9 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
case 'sp_precision':
echo sportspress_get_post_precision( $post_id );
break;
case 'sp_calculate':
echo sportspress_get_post_calculate( $post_id );
break;
case 'sp_player':
echo sportspress_the_posts( $post_id, 'sp_player' );
break;

View File

@@ -11,7 +11,9 @@ function sportspress_sanitize_title( $title ) {
if ( ! $key ) $key = $_POST['post_title'];
$title = sportspress_get_eos_safe_slug( $key, sportspress_array_value( $_POST, 'ID', 'var' ) );
$id = sportspress_array_value( $_POST, 'post_ID', 'var' );
$title = sportspress_get_eos_safe_slug( $key, $id );
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && $_POST['post_type'] == 'sp_event' ):

View File

@@ -47,7 +47,24 @@ function sportspress_save_post( $post_id ) {
break;
case ( 'sp_result' ):
// Delete posts with duplicate key
sportspress_delete_duplicate_post( $_POST );
break;
case ( 'sp_outcome' ):
// Delete posts with duplicate key
sportspress_delete_duplicate_post( $_POST );
break;
case ( 'sp_column' ):
// Delete posts with duplicate key
sportspress_delete_duplicate_post( $_POST );
// Update equation as string
update_post_meta( $post_id, 'sp_equation', implode( ' ', sportspress_array_value( $_POST, 'sp_equation', array() ) ) );
@@ -65,8 +82,11 @@ function sportspress_save_post( $post_id ) {
case ( 'sp_statistic' ):
// Update equation as string
update_post_meta( $post_id, 'sp_equation', implode( ' ', sportspress_array_value( $_POST, 'sp_equation', array() ) ) );
// Delete posts with duplicate key
sportspress_delete_duplicate_post( $_POST );
// Update calculation method as string
update_post_meta( $post_id, 'sp_calculate', sportspress_array_value( $_POST, 'sp_calculate', 'DESC' ) );
break;