Example #1
0
File: Bet.php Project: ksr10/bw
 protected function generateRuleBet($ruleService, $rule)
 {
     $nameParts = explode(' ', $rule['name']);
     $ratioRange = array_pop($nameParts);
     $ratioRangeParts = explode('-', $ratioRange);
     list($from, $to) = $ratioRangeParts;
     $to = (double) $to;
     $from = (double) $from;
     $users = $ruleService->getUsersByRule($rule['id']);
     $ratioService = new RatioService();
     foreach ($users as $user) {
         if ($user['status'] === Bet::USER_STATUS_ACTIVE) {
             $ratio = $ratioService->getRatioForBet($from, $to);
             if ($ratio) {
                 $this->saveBet($ratio, $user, $rule);
             }
         }
     }
 }