mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Fixed visible empty sets in new tournament dialog (#4415)
This commit is contained in:
parent
07ab5cb731
commit
98cc704592
1 changed files with 17 additions and 7 deletions
|
|
@ -2,6 +2,7 @@ package mage.cards.repository;
|
|||
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.dao.DaoManager;
|
||||
import com.j256.ormlite.dao.GenericRawResults;
|
||||
import com.j256.ormlite.jdbc.JdbcConnectionSource;
|
||||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.SelectArg;
|
||||
|
|
@ -83,17 +84,26 @@ public enum ExpansionRepository {
|
|||
}
|
||||
|
||||
public ExpansionInfo[] getWithBoostersSortedByReleaseDate() {
|
||||
ExpansionInfo[] sets = new ExpansionInfo[0];
|
||||
|
||||
try {
|
||||
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
|
||||
qb.orderBy("releaseDate", false);
|
||||
qb.where().eq("boosters", new SelectArg(true));
|
||||
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
|
||||
sets = expansions.toArray(new ExpansionInfo[0]);
|
||||
// only with boosters and cards
|
||||
GenericRawResults<ExpansionInfo> setsList = expansionDao.queryRaw(
|
||||
"select * from expansion e " +
|
||||
" where e.boosters = 1 " +
|
||||
" and exists(select (1) from card c where c.setcode = e.code) " +
|
||||
" order by e.releasedate desc",
|
||||
expansionDao.getRawRowMapper());
|
||||
|
||||
List<ExpansionInfo> resList = new ArrayList<>();
|
||||
for (ExpansionInfo info : setsList) {
|
||||
resList.add(info);
|
||||
}
|
||||
return resList.toArray(new ExpansionInfo[0]);
|
||||
|
||||
} catch (SQLException ex) {
|
||||
logger.error(ex);
|
||||
return new ExpansionInfo[0];
|
||||
}
|
||||
return sets;
|
||||
}
|
||||
|
||||
public List<ExpansionInfo> getSetsWithBasicLandsByReleaseDate() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue