Working on payout display for League, Pokal, GreenShirt
This commit is contained in:
parent
9d70a2dc08
commit
81ab879ecc
4 changed files with 56 additions and 13 deletions
|
|
@ -5,6 +5,7 @@ namespace App;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use Log;
|
||||
use DB;
|
||||
use App\ManualPayout;
|
||||
|
||||
class Quota extends Model
|
||||
{
|
||||
|
|
@ -345,12 +346,24 @@ class Quota extends Model
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Manuelle Payouts hinzufügen
|
||||
// Manuelle Payouts hinzufügen
|
||||
|
||||
$_payouts = Quota::getPayouts();
|
||||
$winners = ManualPayout::getWinners();
|
||||
foreach ($winners as $quota => $userId) {
|
||||
if (!array_key_exists($quota, $_payouts)) continue;
|
||||
$item = array();
|
||||
$item['roundname']=$quota;
|
||||
$item['payout']=$_payouts[$quota];
|
||||
array_push($payouts,$item);
|
||||
}
|
||||
|
||||
return $payouts;
|
||||
}
|
||||
|
||||
public static function getPayoutPerUser($seasonId=-1)
|
||||
{
|
||||
Log::info("starting payout per user");
|
||||
$season = Season::get($seasonId);
|
||||
|
||||
$response = Tipp::getRoundTipps();
|
||||
|
|
@ -382,6 +395,27 @@ class Quota extends Model
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Manuelle Payouts hinzufügen
|
||||
$payouts = Quota::getPayouts();
|
||||
$winners = ManualPayout::getWinners();
|
||||
Log::info("Winners content:");
|
||||
|
||||
foreach ($winners as $quota => $userId) {
|
||||
Log::info($quota." => ".$userId);
|
||||
|
||||
|
||||
if (!array_key_exists($userId, $winners)) {
|
||||
Log::info("Key not found: ".$quota);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log::Info("Manual Payout: quota=".$quota.", Amount=".$payout[$quota].", userId=".$userId);
|
||||
|
||||
$payoutTotal[$userId]['amount'] += $payouts[$quota];
|
||||
}
|
||||
|
||||
$sortedPayout = array();
|
||||
foreach ($payoutTotal as $payout) {
|
||||
$payment = array();
|
||||
|
|
@ -392,9 +426,10 @@ class Quota extends Model
|
|||
}
|
||||
|
||||
|
||||
usort($sortedPayout,array('App\Quota','cmpPayment'));
|
||||
|
||||
//TODO: Manuelle Payouts hinzufügen
|
||||
|
||||
|
||||
usort($sortedPayout,array('App\Quota','cmpPayment'));
|
||||
|
||||
return $sortedPayout;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue