source: trunk/scripts/recompute-ratings @ 1184

Revision 852, 721 bytes checked in by cdleonard@…, 4 years ago (diff)

svn:eol-style native in trunk. Also svn:executable on all scripts

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3
4// recomputes ratings *FROM SCRATCH*
5// (deletes existing ratings)
6//
7// FIXME: It now relies on the `update-ratings` tool. This isn't
8// very efficient since `update-ratings` always starts from scratch.
9
10require_once(dirname($argv[0]) . "/utilities.php");
11require_once(IA_ROOT_DIR."common/db/score.php");
12db_connect();
13
14// first, delete all ratings
15log_print("Deleting all current ratings");
16rating_clear();
17
18$rounds = rating_rounds();
19
20log_print("Recomputing ratings for ".count($rounds)." rounds...");
21$i = 1;
22$cnt = count($rounds);
23foreach ($rounds as $round_id => $round) {
24    echo "\n\n\nRound {$i}/{$cnt} - {$round_id}...\n";
25    system("./update-ratings {$round_id}");
26    $i++;
27}
28
29?>
Note: See TracBrowser for help on using the repository browser.