mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Some improvements for ratio functionality (#1552)
* Some improvements for ratio functionality * Update usercp_viewprofile.tpl * Update functions.php * Update CHANGELOG.md
This commit is contained in:
parent
f4652a4123
commit
4a16ad2c51
6 changed files with 38 additions and 15 deletions
19
common.php
19
common.php
|
@ -291,6 +291,20 @@ function make_rand_str(int $length = 10): string
|
|||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates user ratio
|
||||
*
|
||||
* @param array $btu
|
||||
* @return float|null
|
||||
*/
|
||||
function get_bt_ratio(array $btu): ?float
|
||||
{
|
||||
return
|
||||
(!empty($btu['u_down_total']) && $btu['u_down_total'] > MIN_DL_FOR_RATIO)
|
||||
? round((($btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus']) / $btu['u_down_total']), 2)
|
||||
: null;
|
||||
}
|
||||
|
||||
function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false, $timeout = false)
|
||||
{
|
||||
if ($timeout) {
|
||||
|
@ -345,6 +359,11 @@ function sys(string $param)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some shared defines
|
||||
*/
|
||||
define('RATIO_ENABLED', TR_RATING_LIMITS && MIN_DL_FOR_RATIO > 0);
|
||||
|
||||
// Initialization
|
||||
if (!defined('IN_TRACKER')) {
|
||||
// Init board
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue