Skip to content

Commit

Permalink
Create ship-match jobs with appropriate team sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
AltSysrq committed Sep 19, 2012
1 parent 6e35428 commit 57355d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
30 changes: 17 additions & 13 deletions abserver.txt
Expand Up @@ -529,6 +529,10 @@ INSERT INTO shipCategories (id, name) VALUES
CREATE TABLE shipCategoryRelations (
win INTEGER NOT NULL,
lose INTEGER NOT NULL,
-- Size of win team
nwin INTEGER NOT NULL,
-- Size of lose team
nlose INTEGER NOT NULL,

PRIMARY KEY (win,lose),
KEY (win),
Expand All @@ -540,19 +544,19 @@ CREATE TABLE shipCategoryRelations (
FOREIGN KEY (lose)
REFERENCES shipCategories(id)
) ENGINE=InnoDB DEFAULT CHARSET='utf8';
INSERT INTO shipCategoryRelations (win,lose) VALUES
(0,2),
(0,3),
(1,0),
(1,2),
(2,3),
(2,5),
(3,5),
(3,4),
(4,0),
(4,1),
(5,4),
(5,3);
INSERT INTO shipCategoryRelations (win,lose, nwin,nlose) VALUES
(0,2, 3,1),
(0,3, 5,1),
(1,0, 2,5),
(1,2, 2,1),
(2,3, 2,1),
(2,5, 3,1),
(3,5, 2,1),
(3,4, 3,1),
(4,0, 1,5),
(4,1, 1,3),
(5,4, 1,1),
(5,3, 1,3);

-- Stores information on ships
CREATE TABLE ships (
Expand Down
9 changes: 5 additions & 4 deletions batchjobs.tcl
Expand Up @@ -45,10 +45,11 @@ proc update-batch-jobs {} {
::mysql::sel $mcxn [format {
INSERT INTO jobs (job, createdAt)
SELECT CONCAT('ship-match ',
test.fileid,
' 1 ',
against.fileid,
' 1'), %d
test.fileid, ' ',
shipCategoryRelations.nwin, ' ',
against.fileid, ' ',
shipCategoryRelations.nlose
), %d
FROM ships AS test
JOIN shipCategoryRelations
ON test.category = shipCategoryRelations.win
Expand Down

0 comments on commit 57355d1

Please sign in to comment.