Commit 18455673 authored by Guillaume Jimenez's avatar Guillaume Jimenez

Fixed wrong derived sample being selected.

parent bfbf551b
......@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import utsw.bicf.nucliavault.controller.serialization.AjaxResponse;
import utsw.bicf.nucliavault.controller.serialization.TargetPage;
import utsw.bicf.nucliavault.dao.LoginDAO;
import utsw.bicf.nucliavault.model.NucliaUser;
......@@ -69,9 +70,32 @@ public class LoginController {
model.addAttribute("urlRedirect", "login");
return "logout";
}
@RequestMapping(value = "/logoutAjax")
@ResponseBody
public String logoutAjax(Model model, HttpSession session) throws JsonProcessingException {
loginDAO.closeUserSession(session);
AjaxResponse response = new AjaxResponse();
response.setIsAllowed(true);
response.setSuccess(true);
return response.createObjectJSON();
}
public static boolean isAllowed(Model model) {
return (Boolean) model.asMap().get("isAllowed");
}
@RequestMapping("/oauthresponse")
public String oauthresponse(Model model, String session_state, String state, String code) throws IOException {
AjaxResponse response = new AjaxResponse();
response.setIsAllowed(false);
response.setSuccess(false);
StringBuilder sb = new StringBuilder();
sb.append("session_state=").append(session_state).append("<br/>")
.append("state=").append(state).append("<br/>")
.append("code=").append(code).append("<br/>");
response.setMessage(sb.toString());
ControllerUtil.initializeModel(model, servletContext);
return "login";
}
}
......@@ -228,7 +228,7 @@ public class ClarityDBConnection implements Closeable {
SAMPLES_PER_RUN_SQL.append(" order by udfvalue; ");
DERIVED_SAMPLE_SQL.append(" select luid from container where name in (");
DERIVED_SAMPLE_SQL.append(" select name from container where luid = ?) and luid != ?; ");
DERIVED_SAMPLE_SQL.append(" select name from container where luid = ?) and luid != ? and createddate <= (select createddate from container where luid = ?) order by createddate; ");
}
public ClarityDBConnection(APIResponse response, SubjectDAO subjectDAO, SampleDAO sampleDAO, ModelDAO modelDAO,
......@@ -554,6 +554,7 @@ public class ClarityDBConnection implements Closeable {
PreparedStatement stmt = connection.prepareStatement(DERIVED_SAMPLE_SQL.toString());
stmt.setString(1, currentSampleLuid);
stmt.setString(2, currentSampleLuid);
stmt.setString(3, currentSampleLuid);
ResultSet results = stmt.executeQuery();
Sample derivedFromSample = null;
while (results.next()) {
......@@ -675,9 +676,22 @@ public class ClarityDBConnection implements Closeable {
dnaExtract.setNucExtract(nucExtract);
}
Object din = latestUDFValue(artifactsforSample, locators.get(ArtifactLocator.DIN));
if (din != null)
if (din != null) {
// if (sampleName.equals("ORD1406-27-12560_T_DNA_panel1385v2-1")) {
// System.out.println("Using DIN from artifacts: " + din);
// for (ArtifactResults r : artifactsforSample) {
// if (r.getUdfName().equals("DIN")) {
// System.out.println(r.getSampleName() + " " + r.getUdfName() + " " + r.getUdfValue() + " " + r.getArtifactId());
// }
// }
// }
dnaExtract.setExtractDin(Float.parseFloat(din.toString()));
}
else if (derivedFromDnaExtract != null) {
// if (sampleName.equals("ORD1406-27-12560_T_DNA_panel1385v2-1")) {
// System.out.println("Using DIN from derived sample: " + derivedFromDnaExtract.getExtractDin());
// System.out.println("Using DIN from derived sampleid: " + derivedFromSample.getSampleId() + " nucextractid: " + derivedFromSample.getNucExtract().getNucExtractId());
// }
dnaExtract.setExtractDin(derivedFromDnaExtract.getExtractDin());
}
......@@ -986,6 +1000,7 @@ public class ClarityDBConnection implements Closeable {
List<Object> results = artifactsforSample.stream()
.filter(artifact -> filter(artifact, locator.getProtocolName(), locator.getProcessTypeName(), locator.getUdfName())).sorted()
.map(artifact -> artifact.getUdfValue()).collect(Collectors.toList());
if (results != null && !results.isEmpty()) {
return results.get(results.size() - 1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment