Skip to content

Instantly share code, notes, and snippets.

@abixalmon
Last active August 29, 2015 14:22
Show Gist options
  • Save abixalmon/57016678c0145bf98c99 to your computer and use it in GitHub Desktop.
Save abixalmon/57016678c0145bf98c99 to your computer and use it in GitHub Desktop.
AvistaZ bonus point formula
<?php
if (count($bonus_users)) {
foreach ($bonus_users as $user_id => $bonus_user) {
$torrents = count($bonus_user['torrents']);
if ($torrents < 10) {
$bonus = max(0.1, (0.05 * $torrents));
} else {
$bonus = min(2, 1 + (0.01 * $torrents));
}
foreach ($bonus_user['torrents'] as $torrent) {
if (carbon($torrent['uploaded_date'])->diffInMonths() > 6 && $torrent['seed'] <= 2 && $torrent['leech'] >= 1) {
$bonus = $bonus + 1;
}
if ($torrent['file_size'] > computer_size(10, 'GB')) {
$bonus = $bonus + 0.1;
}
}
DB::update("UPDATE USERS AND SET THE BONUS POINT!");
}
}
?>
@yeuser
Copy link

yeuser commented May 30, 2015

Based on your gist, you made a mistake on explaining: (Example section)

Seed 9 torrents => 9 x 0.05 = 0.45 point per hour
Seed 10 torrents => 1 + (10 x 0.01) = 1.1 point per hour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment