League ordering and extra league information.

This commit is contained in:
marcins78@gmail.com
2012-03-31 06:01:13 +00:00
parent 26cd25b6a7
commit c1fa7d76e0
2 changed files with 8 additions and 8 deletions

View File

@@ -8,8 +8,8 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
public class LeagueDAO {
private DbAccess _dbAccess;
@@ -46,7 +46,7 @@ public class LeagueDAO {
}
}
public Set<League> loadActiveLeagues(int currentTime) throws SQLException, IOException {
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 from league where start<=? and end>=? order by start desc");
@@ -55,7 +55,7 @@ public class LeagueDAO {
statement.setInt(2, currentTime);
ResultSet rs = statement.executeQuery();
try {
Set<League> activeLeagues = new HashSet<League>();
List<League> activeLeagues = new ArrayList<League>();
while (rs.next()) {
int id = rs.getInt(1);
String name = rs.getString(2);

View File

@@ -34,7 +34,7 @@ public class LeagueService {
private Map<LeagueSerieData, List<LeagueStanding>> _leagueSerieStandings = new ConcurrentHashMap<LeagueSerieData, List<LeagueStanding>>();
private int _activeLeaguesLoadedDate;
private Set<League> _activeLeagues;
private List<League> _activeLeagues;
public LeagueService(LeagueDAO leagueDao, LeaguePointsDAO leaguePointsDao, LeagueMatchDAO leagueMatchDao,
CollectionsManager collectionsManager) {
@@ -65,12 +65,12 @@ public class LeagueService {
}
}
public Set<League> getActiveLeagues() {
public List<League> getActiveLeagues() {
if (DateUtils.getCurrentDate() == _activeLeaguesLoadedDate)
return Collections.unmodifiableSet(_activeLeagues);
return Collections.unmodifiableList(_activeLeagues);
else {
ensureLoadedCurrentLeagues();
return Collections.unmodifiableSet(_activeLeagues);
return Collections.unmodifiableList(_activeLeagues);
}
}