sort($seasons); $rounds_to_process = array(); foreach ($seasons as $sid) { ksort($rounds[$sid]); $rounds_to_process = array_merge($rounds_to_process, $rounds[$sid]); } jTipsLogger::_log("round order now fixed (bug 58)"); // // END BUG 58 Fix //////////////////////////////////////////////////// $skippedRounds = $processedRounds = 0; foreach ($rounds_to_process as $id) { //clearHistory($id); $jRound = new jRound($database); $jRound->load($id); //make sure we only process rounds that are pending results if (!$jRound->getStatus()) { $skippedRounds++; jTipsLogger::_log('failed to process this round (' . $jRound->id . ')... it hasnt finished yet! STATUS: ' . $jRound->getStatus()); continue; } if ($jRound->process()) { $processedRounds++; } else { $skippedRounds++; } } $message = $processedRounds . " / " . count($cid) . " " . $jLang['_ADMIN_ROUND_PROCESSED']; //jTipsDebug($message); jTipsLogger::_log($message); mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $message);
$jGame = new jGame($database); $jGame->load($gid); $jGame->home_score = jTipsGetParam($_REQUEST['home_score'], $i, 0); $jGame->away_score = jTipsGetParam($_REQUEST['away_score'], $i, 0); $jGame->bonus_id = jTipsGetParam($_REQUEST['bonus_id'], $i, null); $jGame->draw = null; if ($jGame->home_score > $jGame->away_score) { $jGame->winner_id = $jGame->home_id; } else { if ($jGame->away_score > $jGame->home_score) { $jGame->winner_id = $jGame->away_id; } else { $jGame->winner_id = -1; $jGame->draw = 1; } } if (!$round_id) { $round_id = $jGame->round_id; } $jGame->save(); } if ($round_id) { //now to process the round $jRound = new jRound($database); $jRound->load($round_id); $jRound->process(); $message = '<p class="message">' . $jLang['_ADMIN_ROUND_STATUS_C'] . '</p>'; } else { $message = '<p class="error">' . $jLang['_COM_FAILED'] . ': ' . $jRound->getErrorMsg() . '</p>'; } die($message);