]> git.sesse.net Git - foosball/blobdiff - www/add-single-result.pl
Show the rating difference for each game.
[foosball] / www / add-single-result.pl
index 0037020197c48c3fdbde95f65e430ebfc747d2f3..76edbd043286c37011975375fbe977a7737e99cb 100755 (executable)
@@ -42,10 +42,10 @@ my ($newr2, $newrd2) = foosball::calc_rating($rating2, $rd2, $rating1, $rd1, $sc
 
 $dbh->do('INSERT INTO single_results (gametime,username1,username2,score1,score2) VALUES (CURRENT_TIMESTAMP,?,?,?,?)',
        undef, $username1, $username2, $score1, $score2);
-$dbh->do('INSERT INTO single_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $username1, $newr1, $newrd1);
-$dbh->do('INSERT INTO single_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $username2, $newr2, $newrd2);
+$dbh->do('INSERT INTO single_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $username1, $newr1, $newrd1, $newr1-$rating1);
+$dbh->do('INSERT INTO single_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $username2, $newr2, $newrd2, $newr2-$rating2);
 
 $dbh->commit;