Skip to content

Commit

Permalink
Showing 5 changed files with 32 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changes
=======

1.0.0 to 1.0.1
--------------
* [UI]: Fixed a bug where exporting to Galaxy from the cart was not working.

1.0.0-alpha10 to 1.0.0
----------------------
* [UI]: Fixed a bug where project filtering on the projects table excluded projects that did not have an organism
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<groupId>ca.corefacility.bioinformatics</groupId>
<artifactId>irida</artifactId>
<packaging>war</packaging>
<version>1.0.0</version>
<version>1.0.1</version>
<name>irida</name>
<url>http://www.irida.ca</url>

Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
import ca.corefacility.bioinformatics.irida.service.remote.SampleRemoteService;
import ca.corefacility.bioinformatics.irida.service.sample.SampleService;
import ca.corefacility.bioinformatics.irida.service.user.UserService;
import ca.corefacility.bioinformatics.irida.web.controller.api.projects.RESTProjectSamplesController;
import ca.corefacility.bioinformatics.irida.web.controller.api.samples.RESTSampleSequenceFilesController;

import com.google.common.collect.ImmutableMap;
@@ -326,10 +327,10 @@ private List<Map<String, Object>> getProjectsAsList() {
List<Map<String, Object>> projectList = new ArrayList<>();
for (Project p : projects) {
Set<Sample> selectedSamplesForProject = selected.get(p);
List<Map<String, Object>> samples = getSamplesAsList(selectedSamplesForProject);
List<Map<String, Object>> samples = getSamplesAsList(selectedSamplesForProject, p.getId());

Map<String, Object> projectMap = ImmutableMap
.of("id", p.getId(), "label", p.getLabel(), "samples", samples);
Map<String, Object> projectMap = ImmutableMap.of("id", p.getId(), "label", p.getLabel(), "samples",
samples);
projectList.add(projectMap);
}

@@ -344,11 +345,15 @@ private List<Map<String, Object>> getProjectsAsList() {
* @return A List<Map<String,Object>> containing the relevant Sample
* information
*/
private List<Map<String, Object>> getSamplesAsList(Set<Sample> samples) {
private List<Map<String, Object>> getSamplesAsList(Set<Sample> samples, Long projectId) {
List<Map<String, Object>> sampleList = new ArrayList<>();
for (Sample s : samples) {
Map<String, Object> sampleMap = ImmutableMap.of("id", s.getId(), "label", s.getLabel()
,"sequenceFiles",getSequenceFileList(s));
String sampleHref = linkTo(
methodOn(RESTProjectSamplesController.class).getProjectSample(projectId, s.getId())).withSelfRel()
.getHref();

Map<String, Object> sampleMap = ImmutableMap.of("id", s.getId(), "label", s.getLabel(), "sequenceFiles",
getSequenceFileList(s), "href", sampleHref);
sampleList.add(sampleMap);
}
return sampleList;
7 changes: 2 additions & 5 deletions src/main/webapp/resources/js/modules/cart/irida.cart.js
Original file line number Diff line number Diff line change
@@ -226,14 +226,11 @@
svc.exportFromCart = function (args) {
return CartService.all()
.then(function (data) {
var projects = data;
var projects = data.projects;
_.each(projects, function (project) {
var samples = project.samples;
_.each(samples, function (sample) {
var sequenceFiles = sample.sequenceFiles;
_.each(sequenceFiles, function (sequenceFile) {
addSampleFile(sample.label, sequenceFile.selfRef);
});
addSampleFile(sample.label, sample.href);
});
});
return getSampleFormEntities(args);
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@

import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.google.common.collect.Sets;

import ca.corefacility.bioinformatics.irida.model.joins.Join;
import ca.corefacility.bioinformatics.irida.model.joins.impl.ProjectSampleJoin;
@@ -28,15 +34,13 @@
import ca.corefacility.bioinformatics.irida.service.sample.SampleService;
import ca.corefacility.bioinformatics.irida.service.user.UserService;

import com.google.common.collect.Sets;

public class CartControllerTest {
SampleService sampleService;
ProjectService projectService;
UserService userService;
SequencingObjectService sequencingObjectService;
SampleRemoteService sampleRemoteService;

CartController controller;

private Long projectId;
@@ -51,8 +55,9 @@ public void setup() {
userService = mock(UserService.class);
sequencingObjectService = mock(SequencingObjectService.class);
sampleRemoteService = mock(SampleRemoteService.class);

controller = new CartController(sampleService, userService, projectService, sequencingObjectService, sampleRemoteService);

controller = new CartController(sampleService, userService, projectService, sequencingObjectService,
sampleRemoteService);

testData();
}
@@ -184,6 +189,9 @@ public void testRemoveProject() {

@Test
public void testGetCartMap() {
RequestAttributes ra = new ServletRequestAttributes(new MockHttpServletRequest());
RequestContextHolder.setRequestAttributes(ra);

Map<Project, Set<Sample>> selected = new HashMap<>();
selected.put(project, samples);
controller.setSelected(selected);
@@ -200,6 +208,7 @@ public void testGetCartMap() {
for (Map<String, Object> map : sList) {
assertTrue(map.containsKey("id"));
assertTrue(map.containsKey("label"));
assertTrue(map.containsKey("href"));
}
}

0 comments on commit f343a5e

Please sign in to comment.