Fixed seed bonus accrual (#1518)

* Fixed seed bonus accrual

* Update CHANGELOG.md

* Updated
This commit is contained in:
Roman Kelesidis 2024-06-17 20:50:08 +07:00 committed by GitHub
commit 40b341cb62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 28 additions and 13 deletions

View file

@ -35,12 +35,19 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
$sql = "SELECT last_run
FROM " . BB_CRON . "
WHERE cron_script = '" . basename(__FILE__) . "'
LIMIT 1";
$cron_runs = DB()->fetch_row($sql);
$cron_job_last_run = (TIMENOW - strtotime($cron_runs['last_run']));
foreach ($seed_bonus as $i => $points) {
if (!$points || !$seed_release[$i]) {
continue;
}
$user_points = ((float)$points / 4);
$user_points = ($cron_job_last_run < 3600) ? round((float)$points * ($cron_job_last_run / 3600), 2) : 0;
$release = (int)$seed_release[$i];
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);