Skip to content

Commit

Permalink
Merge pull request #154 from leojonathanoh/enhancement/asp-add-config…
Browse files Browse the repository at this point in the history
…uration-option-to-hide-ranking-of-new-players

Enhancement (ASP): Add configuration option to hide ranking of new players
  • Loading branch information
leojonathanoh authored Jan 28, 2024
2 parents ee08343 + da0bfd7 commit 9860421
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ASP/bf2statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@
if(empty($country))
$country = 'xx';

$hidden = '';
if (Config::Get('stats_hide_new_players')) {
$hidden .= ', hidden = 1';
}else {
$hidden .= ', hidden = 0';
}

// Insert information
$query = "INSERT INTO player SET
id = " . $data["pID_$x"] . ",
Expand Down Expand Up @@ -445,6 +452,7 @@
mode1 = " . $globals['mode1'] .",
mode2 = " . $globals['mode2'] .",
isbot = ". $data["ai_$x"] ."
$hidden
";
$result = $DB->exec( $query );
checkQueryResult($result, $query, $DB);
Expand Down
9 changes: 9 additions & 0 deletions src/ASP/frontend/views/editconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
</select>
</div>
</div>
<div class="mws-form-row">
<label>Auto-hide new players:</label>
<div class="mws-form-item small">
<select name="cfg__stats_hide_new_players" title="Auto-hide new players from ranking.">
<option value="true" <?php if('{config.stats_hide_new_players}' == true) echo 'selected="selected"'; ?>>Yes</option>
<option value="false" <?php if('{config.stats_hide_new_players}' == false) echo 'selected="selected"'; ?>>No</option>
</select>
</div>
</div>
<div class="mws-form-row">
<label>Min. Game Time (Round):</label>
<div class="mws-form-item small">
Expand Down
1 change: 1 addition & 0 deletions src/ASP/system/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$admin_backup_ext = '.bak';
$admin_ignore_ai = 0;
$stats_ignore_ai = 0;
$stats_hide_new_players = false;
$stats_min_game_time = 0;
$stats_min_player_game_time = 0;
$stats_players_min = 1;
Expand Down
1 change: 1 addition & 0 deletions src/ASP/system/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private static function getDefault()
'admin_backup_ext' => '.bak',
'admin_ignore_ai' => 0,
'stats_ignore_ai' => 0,
'stats_hide_new_players' => false,
'stats_min_game_time' => 0,
'stats_min_player_game_time' => 0,
'stats_players_min' => 1,
Expand Down

0 comments on commit 9860421

Please sign in to comment.