Fixing display of league results.

This commit is contained in:
marcins78@gmail.com
2012-01-15 02:53:26 +00:00
parent 1b95925995
commit eac8e91ea7
3 changed files with 31 additions and 16 deletions

View File

@@ -45,19 +45,20 @@ public class LeagueSerieDAO {
try {
Connection conn = _dbAccess.getDataSource().getConnection();
try {
PreparedStatement statement = conn.prepareStatement("select season_type, format, max_matches, start, end from league_season where league_type=? order by start asc");
PreparedStatement statement = conn.prepareStatement("select league_type, season_type, format, max_matches, start, end from league_season where league_type=? order by start asc");
try {
statement.setString(1, league.getType());
ResultSet rs = statement.executeQuery();
try {
List<LeagueSerie> seasons = new LinkedList<LeagueSerie>();
while (rs.next()) {
String type = rs.getString(1);
String format = rs.getString(2);
int maxMatches = rs.getInt(3);
int start = rs.getInt(4);
int end = rs.getInt(5);
seasons.add(new LeagueSerie(type, format, maxMatches, start, end));
String leagueType = rs.getString(1);
String type = rs.getString(2);
String format = rs.getString(3);
int maxMatches = rs.getInt(4);
int start = rs.getInt(5);
int end = rs.getInt(6);
seasons.add(new LeagueSerie(leagueType, type, format, maxMatches, start, end));
}
return seasons;
} finally {
@@ -78,7 +79,7 @@ public class LeagueSerieDAO {
try {
Connection conn = _dbAccess.getDataSource().getConnection();
try {
PreparedStatement statement = conn.prepareStatement("select season_type, format, max_matches, start, end from league_season where league_type=? and start<=? and end>=?");
PreparedStatement statement = conn.prepareStatement("select league_type, season_type, format, max_matches, start, end from league_season where league_type=? and start<=? and end>=?");
try {
statement.setString(1, league.getType());
statement.setInt(2, inTime);
@@ -86,12 +87,13 @@ public class LeagueSerieDAO {
ResultSet rs = statement.executeQuery();
try {
if (rs.next()) {
String type = rs.getString(1);
String format = rs.getString(2);
int maxMatches = rs.getInt(3);
int start = rs.getInt(4);
int end = rs.getInt(5);
return new LeagueSerie(type, format, maxMatches, start, end);
String leagueType = rs.getString(1);
String type = rs.getString(2);
String format = rs.getString(3);
int maxMatches = rs.getInt(4);
int start = rs.getInt(5);
int end = rs.getInt(6);
return new LeagueSerie(leagueType, type, format, maxMatches, start, end);
}
return null;
} finally {

View File

@@ -1,13 +1,15 @@
package com.gempukku.lotro.db.vo;
public class LeagueSerie {
private String _leagueType;
private String _type;
private String _format;
private int _maxMatches;
private int _start;
private int _end;
public LeagueSerie(String type, String format, int maxMatches, int start, int end) {
public LeagueSerie(String leagueType, String type, String format, int maxMatches, int start, int end) {
_leagueType = leagueType;
_type = type;
_format = format;
_maxMatches = maxMatches;
@@ -42,6 +44,7 @@ public class LeagueSerie {
LeagueSerie that = (LeagueSerie) o;
if (_leagueType != null ? !_leagueType.equals(that._leagueType) : that._leagueType != null) return false;
if (_type != null ? !_type.equals(that._type) : that._type != null) return false;
return true;
@@ -49,6 +52,12 @@ public class LeagueSerie {
@Override
public int hashCode() {
return _type != null ? _type.hashCode() : 0;
int result = _leagueType != null ? _leagueType.hashCode() : 0;
result = 31 * result + (_type != null ? _type.hashCode() : 0);
result = 31 * result + (_format != null ? _format.hashCode() : 0);
result = 31 * result + _maxMatches;
result = 31 * result + _start;
result = 31 * result + _end;
return result;
}
}

View File

@@ -0,0 +1,4 @@
1x(S)TTT - Starter
6xTTT - Booster
2x4_249
1x4_356