Active leagues redefinition - removing league start date.
This commit is contained in:
@@ -17,19 +17,18 @@ public class LeagueDAO {
|
||||
_dbAccess = dbAccess;
|
||||
}
|
||||
|
||||
public void addLeague(int cost, String name, String type, String clazz, String parameters, int startTime, int endTime) throws SQLException, IOException {
|
||||
public void addLeague(int cost, String name, String type, String clazz, String parameters, int endTime) throws SQLException, IOException {
|
||||
Connection conn = _dbAccess.getDataSource().getConnection();
|
||||
try {
|
||||
PreparedStatement statement = conn.prepareStatement("insert into league (name, type, class, parameters, start, end, status, cost) values (?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement statement = conn.prepareStatement("insert into league (name, type, class, parameters, end, status, cost) values (?, ?, ?, ?, ?, ?, ?)");
|
||||
try {
|
||||
statement.setString(1, name);
|
||||
statement.setString(2, type);
|
||||
statement.setString(3, clazz);
|
||||
statement.setString(4, parameters);
|
||||
statement.setInt(5, startTime);
|
||||
statement.setInt(6, endTime);
|
||||
statement.setInt(7, 0);
|
||||
statement.setInt(8, cost);
|
||||
statement.setInt(5, endTime);
|
||||
statement.setInt(6, 0);
|
||||
statement.setInt(7, cost);
|
||||
statement.execute();
|
||||
} finally {
|
||||
statement.close();
|
||||
@@ -42,7 +41,7 @@ public class LeagueDAO {
|
||||
public List<League> loadActiveLeagues(int currentTime) throws SQLException, IOException {
|
||||
Connection conn = _dbAccess.getDataSource().getConnection();
|
||||
try {
|
||||
PreparedStatement statement = conn.prepareStatement("select id, name, type, class, parameters, start, end, status, cost from league where start<=? and end>=? order by start desc");
|
||||
PreparedStatement statement = conn.prepareStatement("select id, name, type, class, parameters, status, cost from league where end>=? order by start desc");
|
||||
try {
|
||||
statement.setInt(1, currentTime);
|
||||
statement.setInt(2, currentTime);
|
||||
@@ -55,11 +54,9 @@ public class LeagueDAO {
|
||||
String type = rs.getString(3);
|
||||
String clazz = rs.getString(4);
|
||||
String parameters = rs.getString(5);
|
||||
int start = rs.getInt(6);
|
||||
int end = rs.getInt(7);
|
||||
int status = rs.getInt(8);
|
||||
int cost = rs.getInt(9);
|
||||
activeLeagues.add(new League(id, cost, name, type, clazz, parameters, start, end, status));
|
||||
int status = rs.getInt(6);
|
||||
int cost = rs.getInt(7);
|
||||
activeLeagues.add(new League(id, cost, name, type, clazz, parameters, status));
|
||||
}
|
||||
return activeLeagues;
|
||||
} finally {
|
||||
|
||||
@@ -11,19 +11,15 @@ public class League {
|
||||
private String _type;
|
||||
private String _clazz;
|
||||
private String _parameters;
|
||||
private int _start;
|
||||
private int _end;
|
||||
private int _status;
|
||||
|
||||
public League(int id, int cost, String name, String type, String clazz, String parameters, int start, int end, int status) {
|
||||
public League(int id, int cost, String name, String type, String clazz, String parameters, int status) {
|
||||
_id = id;
|
||||
_cost = cost;
|
||||
_name = name;
|
||||
_type = type;
|
||||
_clazz = clazz;
|
||||
_parameters = parameters;
|
||||
_start = start;
|
||||
_end = end;
|
||||
_status = status;
|
||||
}
|
||||
|
||||
@@ -53,14 +49,6 @@ public class League {
|
||||
}
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return _start;
|
||||
}
|
||||
|
||||
public int getEnd() {
|
||||
return _end;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return _status;
|
||||
}
|
||||
|
||||
@@ -88,12 +88,11 @@ public class AdminResource extends AbstractResource {
|
||||
@FormParam("type") String type,
|
||||
@FormParam("class") String clazz,
|
||||
@FormParam("parameters") String parameters,
|
||||
@FormParam("start") int start,
|
||||
@FormParam("end") int end,
|
||||
@Context HttpServletRequest request) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
_leagueDao.addLeague(cost, name, type, clazz, parameters, start, end);
|
||||
_leagueDao.addLeague(cost, name, type, clazz, parameters, end);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<option value="com.gempukku.lotro.league.SealedLeagueData">Sealed</option>
|
||||
</select><br/>
|
||||
Parameters: <input type="text" name="parameters"><br/>
|
||||
Start: <input type="text" name="start"><br/>
|
||||
Cost: <input type="text" name="cost"><br/>
|
||||
End: <input type="text" name="end"><br/>
|
||||
<input type="submit" value="Add league">
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user