mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix so set groups sorted by date in reverse chronological order
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
package forge.itemmanager;
|
package forge.itemmanager;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardType;
|
import forge.card.CardType;
|
||||||
@@ -244,11 +247,16 @@ public enum GroupDef {
|
|||||||
private static String[] getSetGroups() {
|
private static String[] getSetGroups() {
|
||||||
setGroupMap = new HashMap<String, Integer>(); //cache mappings to make lookup quicker later
|
setGroupMap = new HashMap<String, Integer>(); //cache mappings to make lookup quicker later
|
||||||
|
|
||||||
|
//build sorted list of sets
|
||||||
|
List<CardEdition> sortedSets = Lists.newArrayList(FModel.getMagicDb().getEditions());
|
||||||
|
Collections.sort(sortedSets);
|
||||||
|
Collections.reverse(sortedSets);
|
||||||
|
|
||||||
int groupNum = 0;
|
int groupNum = 0;
|
||||||
String[] setGroups = new String[FModel.getMagicDb().getEditions().size()];
|
String[] setGroups = new String[sortedSets.size()];
|
||||||
for (CardEdition edition : FModel.getMagicDb().getEditions()) {
|
for (CardEdition set : sortedSets) {
|
||||||
setGroups[groupNum] = edition.getName();
|
setGroups[groupNum] = set.getName();
|
||||||
setGroupMap.put(edition.getCode(), groupNum);
|
setGroupMap.put(set.getCode(), groupNum);
|
||||||
groupNum++;
|
groupNum++;
|
||||||
}
|
}
|
||||||
return setGroups;
|
return setGroups;
|
||||||
|
|||||||
Reference in New Issue
Block a user