Skip to content

Commit

Permalink
(#1904) Reverse order of DataSet and File lists
Browse files Browse the repository at this point in the history
  • Loading branch information
squaregoldfish committed Jul 23, 2024
1 parent b5ccfaa commit 5fbc44a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
23 changes: 19 additions & 4 deletions WebApp/src/uk/ac/exeter/QuinCe/web/datasets/DataSetsBean.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package uk.ac.exeter.QuinCe.web.datasets;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -140,12 +142,25 @@ public String goToList() {
}

/**
* Get the data sets for the current instrument
* Get the {@link DataSet}s for the current instrument.
*
* @return The data sets
* <p>
* The list is presented in reverse order, i.e. with the newest
* {@link DataSet} first.
* </p>
*
* @return The {@link DataSet}s
*/
public Collection<DataSet> getDataSets() {
return null == dataSets ? null : dataSets.values();
public List<DataSet> getDataSets() {

List<DataSet> result = null;

if (null != dataSets) {
result = new ArrayList<DataSet>(dataSets.values().stream().toList());
Collections.reverse(result);
}

return result;
}

public Collection<DataSet> getDatasetsForApproval() {
Expand Down
3 changes: 3 additions & 0 deletions WebApp/src/uk/ac/exeter/QuinCe/web/files/DataFilesBean.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.ac.exeter.QuinCe.web.files;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.faces.bean.ManagedBean;
Expand Down Expand Up @@ -68,6 +69,8 @@ public List<DataFile> getListFiles()
result = new ArrayList<DataFile>();
}

Collections.reverse(result);

return result;
}
}

0 comments on commit 5fbc44a

Please sign in to comment.