Permalink
Browse files

Fix my scheduling goof

  • Loading branch information...
1 parent ea911dd commit 65908374f880889648f4ed6cf7091e53dd6bdefd @eonarheim eonarheim committed May 29, 2012
View
@@ -40,12 +40,12 @@ CREATE TABLE `tourney`.`tournaments` (
`startTime` DATETIME NOT NULL,
`maxBrokers` integer UNSIGNED NOT NULL,
`status` VARCHAR(32) NOT NULL,
- `gameSize1` integer NOT NULL DEFAULT 2,
- `numberGameSize1` integer NOT NULL DEFAULT 2,
- `gameSize2` integer NOT NULL DEFAULT 4,
- `numberGameSize2` integer NOT NULL DEFAULT 4,
- `gameSize3` integer NOT NULL DEFAULT 8,
- `numberGameSize3` integer NOT NULL DEFAULT 4,
+ `gameSize1` integer NOT NULL,
+ `numberGameSize1` integer NOT NULL,
+ `gameSize2` integer NOT NULL,
+ `numberGameSize2` integer NOT NULL,
+ `gameSize3` integer NOT NULL,
+ `numberGameSize3` integer NOT NULL,
`maxBrokerInstances` integer NOT NULL DEFAULT 2,
`type` VARCHAR(32) NOT NULL, /* Type is either multi-game or single game if single game ignore the gameSize params */
`pomUrl` VARCHAR(256) NOT NULL, /* This will be the url to the pom file */
@@ -312,6 +312,15 @@ public String createTournament ()
e2.printStackTrace();
}
+ int[] gtypes = new int[3];
+ int[] mxs = new int[3];
+ gtypes[0] = size1;
+ gtypes[1] = size2;
+ gtypes[2] = size3;
+ mxs[0] = numberSize1;
+ mxs[1] = numberSize2;
+ mxs[2] = numberSize3;
+
Database db = new Database();
newTourney.setPomUrl(hostip
@@ -333,7 +342,7 @@ public String createTournament ()
System.out.println("Adding tourney");
db.addTournament(newTourney.getTournamentName(), true, size1,
startTime, "SINGLE_GAME",
- newTourney.getPomUrl(), allLocations, maxBrokers);
+ newTourney.getPomUrl(), allLocations, maxBrokers,gtypes,mxs);
// Grabs the tourney Id
System.out.println("Getting tourneyId");
@@ -456,7 +465,7 @@ else if (type == TourneyType.MULTI_GAME) {
System.out.println("[INFO] Creating New tourney");
db.addTournament(tournamentName, true, numberOfGames,
startTime, "MULTI_GAME",
- newTourney.getPomUrl(), allLocations, maxBrokers);
+ newTourney.getPomUrl(), allLocations, maxBrokers,gtypes,mxs);
// Grabs the tourney Id
System.out.println("[INFO] Getting tourneyId");
@@ -188,7 +188,7 @@
*/
public static final String ADD_TOURNAMENT =
- "INSERT INTO tourney.tournaments (tourneyName, startTime, openRegistration,maxGames, type, pomUrl, locations, maxBrokers, status) VALUES (?,?,?,?,?,?,?,?,'pending');";
+ "INSERT INTO tourney.tournaments (tourneyName, startTime, openRegistration,maxGames, type, pomUrl, locations, maxBrokers, status, gameSize1, gameSize2, gameSize3, numberGameSize1,numberGameSize2,numberGameSize3) VALUES (?,?,?,?,?,?,?,?,'pending',?,?,?,?,?,?);";
/***
* Updates a particular tournament given the id
@@ -523,7 +523,8 @@ public void setUploadingUser (String uploadingUser)
public int addTournament (String tourneyName, boolean openRegistration,
int maxGames, Date startTime, String type,
- String pomUrl, String locations, int maxBrokers)
+ String pomUrl, String locations, int maxBrokers,
+ int[] gameSizes, int[] numGames)
throws SQLException
{
@@ -540,10 +541,18 @@ public int addTournament (String tourneyName, boolean openRegistration,
addTournament.setString(6, pomUrl);
addTournament.setString(7, locations);
addTournament.setInt(8, maxBrokers);
-
+ addTournament.setInt(9, gameSizes[0]);
+ addTournament.setInt(10, gameSizes[1]);
+ addTournament.setInt(11, gameSizes[2]);
+ addTournament.setInt(12, numGames[0]);
+ addTournament.setInt(13, numGames[1]);
+ addTournament.setInt(14, numGames[2]);
+
return addTournament.executeUpdate();
}
+
+
public List<Tournament> getTournaments (String status) throws SQLException
{

0 comments on commit 6590837

Please sign in to comment.