]> git.sesse.net Git - foosball/blobdiff - www/add-double-result.pl
Show the rating difference for each game.
[foosball] / www / add-double-result.pl
index 07cefa8bd2b1f6084639330158ae1b18816ae5b4..0f269ab42e0b162a0fe050e909ecf567a8a8adf6 100755 (executable)
@@ -67,14 +67,14 @@ my (undef, $newrd2_2) = foosball::calc_rating($rating2_2, $rd2_2, $rating_team1,
 
 $dbh->do('INSERT INTO double_results (gametime,team1_username1,team1_username2,team2_username1,team2_username2,score1,score2) VALUES (CURRENT_TIMESTAMP,?,?,?,?,?,?)',
        undef, $team1_username1, $team1_username2, $team2_username1, $team2_username2, $score1, $score2);
-$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $team1_username1, $newr1_1, $newrd1_1);
-$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $team1_username2, $newr1_2, $newrd1_2);
-$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $team2_username1, $newr2_1, $newrd2_1);
-$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?)',
-       undef, $team2_username2, $newr2_2, $newrd2_2);
+$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $team1_username1, $newr1_1, $newrd1_1, $newr1_1-$rating1_1);
+$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $team1_username2, $newr1_2, $newrd1_2, $newr1_2-$rating1_2);
+$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $team2_username1, $newr2_1, $newrd2_1, $newr2_1-$rating2_1);
+$dbh->do('INSERT INTO double_rating (username,ratetime,rating,rd) VALUES (?,CURRENT_TIMESTAMP,?,?,?)',
+       undef, $team2_username2, $newr2_2, $newrd2_2, $newr2_2-$rating2_2);
 
 $dbh->commit;