sql to create synthetic games points enhanced
[brisk.git] / sql / sql.d / 066-insert-unnorm-games.sql.test
1 DELETE FROM bsk_bin5_matches WHERE code = 100 OR code = 101;
2
3 INSERT INTO bsk_bin5_matches (code, ttok, tidx, mazzo_next, mult_next) VALUES (100, 'normalize_points', 2, 1, 1) RETURNING *;
4 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (100, 10101, 0);
5 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (100, 10102, 1);
6 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (100, 10103, 2);
7 INSERT INTO bsk_bin5_games (code, mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult)
8                       VALUES (200, 100, to_timestamp(139000000), 2, 60, 0, -1, -1, 0, 0) RETURNING *;
9 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (200, 10101, 0);
10 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (200, 10102, 0);
11 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (200, 10103, 0);
12 UPDATE bsk_bin5_matches SET (mazzo_next, mult_next) = (2, 0) WHERE code = 100;
13 INSERT INTO bsk_bin5_games (code, mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult)
14                       VALUES (201, 100, to_timestamp(139000100), 0, 61, 37, 2, 1, 1, 1) RETURNING *;
15 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (201, 10101, 2);
16 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (201, 10102, -2);
17 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (201, 10103, -4);
18
19
20 INSERT INTO bsk_bin5_matches (code, ttok, tidx, mazzo_next, mult_next) VALUES (101, 'normalize_points2', 2, 1, 0) RETURNING *;
21 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (101, 10101, 0);
22 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (101, 10102, 1);
23 INSERT INTO bsk_bin5_table_orders (mcode, ucode, pos) VALUES (101, 10103, 2);
24 INSERT INTO bsk_bin5_games (code, mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult)
25                       VALUES (202, 101, to_timestamp(139000200), 2, 60, 0, -1, -1, 0, 0) RETURNING *;
26 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (202, 10101, 0);
27 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (202, 10102, 0);
28 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (202, 10103, 0);
29 UPDATE bsk_bin5_matches SET (mazzo_next, mult_next) = (2, 0) WHERE code = 100;
30 INSERT INTO bsk_bin5_games (code, mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult)
31                       VALUES (203, 101, to_timestamp(139000300), 0, 81, 37, 2, 1, 1, 1) RETURNING *;
32 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (203, 10101, 6);
33 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (203, 10102, -6);
34 INSERT INTO bsk_bin5_points (gcode, ucode, pts) VALUES (203, 10103, -12);
35
36
37