function checkRelatively() { #---------------------------------------------------------------------- global $competitionCondition, $chosenWhich; echo "<hr /><p>Checking <b>" . $chosenWhich . " ranks</b>... (wait for the result message box at the end)</p>\n"; #--- Get all results (except the trick-duplicated (old) multiblind) $rows = dbQueryHandle("\n SELECT result.id, competitionId, eventId, roundId, formatId, average, best, pos, personName\n FROM Results result, Competitions competition\n WHERE competition.id = competitionId\n {$competitionCondition}\n AND (( eventId <> '333mbf' ) OR (( competition.year = 2009 ) AND ( competition.month > 1 )) OR ( competition.year > 2009 ))\n ORDER BY year desc, month desc, day desc, competitionId, eventId, roundId, IF(formatId IN ('a','m') AND average>0, average, 2147483647), if(best>0, best, 2147483647), pos\n "); #--- Begin the form echo "<form action='check_results_ACTION.php' method='post'>\n"; #--- Check the pos values $prevRound = $shownRound = ''; $wrongs = $wrongRounds = 0; $wrongComp = array(); while ($row = mysql_fetch_row($rows)) { list($resultId, $competitionId, $eventId, $roundId, $formatId, $average, $best, $storedPos, $personName) = $row; $round = "{$competitionId}|{$eventId}|{$roundId}"; if ($formatId == 'm' || $formatId == 'a') { $result = "{$average}|{$best}"; } else { $result = $best; } if ($round != $prevRound) { $ctr = $calcedPos = 1; } if ($ctr > 1 && $result != $prevResult) { $calcedPos = $ctr; } if ($storedPos != $calcedPos) { #--- Before the first difference in a round, show the round's full results if ($round != $shownRound) { $wrongRounds++; $wrongComp[$competitionId] = true; echo "<p style='margin-top:2em; margin-bottom:0'><a href='https://www.worldcubeassociation.org/results/c.php?i={$competitionId}&allResults=1#e{$eventId}_{$roundId}'>{$competitionId} - {$eventId} - {$roundId}</a></p>"; showCompetitionResults($competitionId, $eventId, $roundId); $shownRound = $round; #--- Show a check all and a check none button. printf("<button class='js-check-all' data-round='{$round}'>Check all</button>"); printf("<button class='js-check-none' data-round='{$round}'>Check none</button>"); printf("<br>"); } #--- Show each difference, with a checkbox to agree $change = sprintf('%+d', $calcedPos - $storedPos); $checkbox = "<input type='checkbox' name='setpos{$resultId}' value='{$calcedPos}' data-round='{$round}' />"; printf("{$checkbox} Place {$storedPos} should be place {$calcedPos} (change by {$change}) --- {$personName}<br />"); $wrongs++; } $prevRound = $round; $prevResult = $result; $ctr++; } mysql_free_result($rows); #--- Tell the result. $date = wcaDate(); noticeBox2(!$wrongs, "We agree about all checked places.<br />{$date}", "<p>Darn! We disagree: {$wrongs} possibly wrong places, in {$wrongRounds} rounds, in " . count($wrongComp) . " competitions<br /><br />{$date}</p>" . "<p>Choose the changes you agree with above, then click the 'Execute...' button below. It will result in something like the following.</p>" . "<pre>I'm doing this:\n" . "UPDATE Results SET pos=111 WHERE id=11111\n" . "UPDATE Results SET pos=222 WHERE id=22222\n" . "UPDATE Results SET pos=333 WHERE id=33333\n" . "</pre>"); #--- If differences were found, offer to fix them. if ($wrongs) { echo "<center><input type='submit' value='Execute the agreed changes!' /></center>\n"; } #--- Finish the form. echo "</form>\n"; }
require 'includes/_footer.php'; exit(0); } #--- Show competition infos. require 'includes/competition_infos.php'; showCompetitionInfos(); if (wcaDate('Ymd') >= 10000 * $competition['year'] + 100 * $competition['month'] + $competition['day']) { #--- Try the cache # tryCache( 'competition', $chosenCompetitionId, $chosenByPerson, $chosenAllResults, $chosenTop3, $chosenWinners ); #--- Show competition results... offerChoicesResults(); require 'includes/competition_results.php'; if ($chosenByPerson) { showCompetitionResultsByPerson(); } else { showCompetitionResults(); } } else { if ($competition['use_wca_registration']) { #--- Show the prereg form. offerChoicesPrereg(); } } require 'includes/_footer.php'; #---------------------------------------------------------------------- function analyzeChoices() { #---------------------------------------------------------------------- global $chosenCompetitionId; global $chosenByPerson, $chosenAllResults, $chosenTop3, $chosenWinners; global $chosenForm, $chosenList;