Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2962 Setting run type aliases when uploading files isn't working #2963

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,11 @@
* @return The run type values
*/
public List<String> getRunTypeValues() {
List<String> values = null;
List<String> values;

if (null != runTypes) {
if (null == runTypes) {
values = new ArrayList<String>(0);

Check warning on line 664 in WebApp/src/uk/ac/exeter/QuinCe/data/Instrument/FileDefinition.java

View check run for this annotation

Codecov / codecov/patch

WebApp/src/uk/ac/exeter/QuinCe/data/Instrument/FileDefinition.java#L664

Added line #L664 was not covered by tests
} else {
values = new ArrayList<String>(runTypes.size());
values.addAll(runTypes.keySet());
}
Expand Down
12 changes: 9 additions & 3 deletions WebApp/src/uk/ac/exeter/QuinCe/web/files/MissingRunType.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package uk.ac.exeter.QuinCe.web.files;

import java.util.List;
import java.util.Set;

import uk.ac.exeter.QuinCe.data.Instrument.FileDefinition;
import uk.ac.exeter.QuinCe.data.Instrument.RunTypes.RunTypeAssignment;

public record MissingRunType(FileDefinition fileDefinition,
RunTypeAssignment runType) {
protected static boolean contains(List<MissingRunType> list,
RunTypeAssignment runType) implements Comparable<MissingRunType> {

protected static boolean contains(Set<MissingRunType> list,
FileDefinition fileDefinition, String runName) {
return list.stream().anyMatch(r -> r.fileDefinition.equals(fileDefinition)
&& r.runType.getRunName().equals(runName));
}

@Override
public int compareTo(MissingRunType o) {
return runType.getRunName().compareTo(o.runType.getRunName());

Check warning on line 19 in WebApp/src/uk/ac/exeter/QuinCe/web/files/MissingRunType.java

View check run for this annotation

Codecov / codecov/patch

WebApp/src/uk/ac/exeter/QuinCe/web/files/MissingRunType.java#L19

Added line #L19 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.ac.exeter.QuinCe.web.files;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.TreeSet;
Expand Down Expand Up @@ -29,7 +28,7 @@
*/
private TreeSet<UploadedDataFile> dataFiles = new TreeSet<UploadedDataFile>();

private List<MissingRunType> unrecognisedRunTypes;
private TreeSet<MissingRunType> unrecognisedRunTypes;

@Override
public void processUploadedFile() {
Expand Down Expand Up @@ -131,7 +130,7 @@
}

private void buildUnrecognisedRunTypes() {
unrecognisedRunTypes = new ArrayList<MissingRunType>();
unrecognisedRunTypes = new TreeSet<MissingRunType>();

Check warning on line 133 in WebApp/src/uk/ac/exeter/QuinCe/web/files/MultipleFileUploadBean.java

View check run for this annotation

Codecov / codecov/patch

WebApp/src/uk/ac/exeter/QuinCe/web/files/MultipleFileUploadBean.java#L133

Added line #L133 was not covered by tests

for (UploadedDataFile file : dataFiles) {
for (RunTypeAssignment runType : file.getMissingRunTypes()) {
Expand All @@ -144,7 +143,7 @@
}
}

public List<MissingRunType> getUnrecognisedRunTypes() {
public TreeSet<MissingRunType> getUnrecognisedRunTypes() {

if (null == unrecognisedRunTypes) {
buildUnrecognisedRunTypes();
Expand Down
Loading