]> git.sesse.net Git - ccbs/commitdiff
Add an SQL snippet for fixing some stuff related to chosen/random songs in the data...
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Mar 2005 03:13:13 +0000 (03:13 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Mar 2005 03:13:13 +0000 (03:13 +0000)
sql/fixup-chosensongs.sql [new file with mode: 0644]

diff --git a/sql/fixup-chosensongs.sql b/sql/fixup-chosensongs.sql
new file mode 100644 (file)
index 0000000..c884a31
--- /dev/null
@@ -0,0 +1,19 @@
+--
+-- Fix some brokenness in the data we get from DDR Europe; specifically,
+-- if all players in a round select the same chosen song, the data says
+-- that is was a random song. We find the most obvious cases and fix them;
+-- I don't believe there are any more of them than those.
+--
+
+BEGIN;
+
+UPDATE scores SET chosen='t' WHERE (tournament,round,songnumber) IN (
+       SELECT tournament,round,randomsongs-1 FROM rounds WHERE chosensongs = 0 AND randomsongs > 1
+);
+
+UPDATE rounds SET chosensongs=1,randomsongs=randomsongs-1 WHERE (tournament,round) IN (
+       SELECT tournament, round FROM rounds WHERE chosensongs = 0 AND randomsongs > 1
+);
+
+COMMIT;
+