Skip to content

Commit 598f94d

Browse files
committed
Couple more fixes
1 parent bfa5122 commit 598f94d

3 files changed

Lines changed: 29 additions & 10 deletions

File tree

nirc_ehr/resources/queries/study/necropsy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
5454
date: row.date,
5555
weight: row.necropsyWeight,
5656
taskid: row.taskid,
57-
qcstate: qcstate
57+
qcstate: qcstate,
58+
performedby: row.performedby
5859
};
5960
triggerHelper.upsertWeightRecord(weightRecord);
6061
}

nirc_ehr/src/org/labkey/nirc_ehr/query/NIRC_EHRTriggerHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ public void upsertWeightRecord(Map<String, Object> row) throws QueryUpdateServic
323323
saveRow.put("date", date);
324324
saveRow.put("taskid", taskId);
325325
saveRow.put("qcstate", row.get("qcstate"));
326+
saveRow.put("performedby", row.get("performedby"));
326327
if (updateRecord)
327328
{
328329
saveRow.put("objectid", ts.getMap().get("objectid"));

nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.labkey.test.util.LogMethod;
5454
import org.labkey.test.util.PortalHelper;
5555
import org.labkey.test.util.PostgresOnlyTest;
56+
import org.labkey.test.util.ehr.EHRClientAPIHelper;
5657
import org.labkey.test.util.ext4cmp.Ext4FieldRef;
5758
import org.labkey.test.util.ext4cmp.Ext4GridRef;
5859
import org.openqa.selenium.Keys;
@@ -98,6 +99,10 @@ public class NIRC_EHRTest extends AbstractGenericEHRTest implements PostgresOnly
9899
private static final String deadAnimalId = "D5454";
99100
private static final String departedAnimalId = "H6767";
100101
private static final String aliveAnimalId = "A4545";
102+
103+
private String[] weightFields = {"Id", "date", "enddate", "project", "weight", FIELD_QCSTATELABEL, FIELD_OBJECTID, FIELD_LSID, "_recordid", "performedby"};
104+
private Object[] weightData1 = {getExpectedAnimalIDCasing("TESTSUBJECT1"), EHRClientAPIHelper.DATE_SUBSTITUTION, null, null, "12", EHRQCState.IN_PROGRESS.label, null, null, "_recordID", 1004};
105+
101106
DateTimeFormatter _dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
102107

103108
@BeforeClass
@@ -455,6 +460,18 @@ protected void createTestSubjects() throws Exception
455460
primeCaches();
456461
}
457462

463+
@Override
464+
protected String[] getWeightFields()
465+
{
466+
return weightFields;
467+
}
468+
469+
@Override
470+
protected Object[] getWeightData1()
471+
{
472+
return weightData1;
473+
}
474+
458475
@Test
459476
public void testArrivalForm()
460477
{
@@ -718,35 +735,35 @@ public void createSubjectsForDeathForm() throws IOException, CommandException
718735
goToSchemaBrowser();
719736
log("Creating animals");
720737
getApiHelper().doSaveRows(DATA_ADMIN.getEmail(), getApiHelper().prepareInsertCommand("study", "birth", "lsid",
721-
new String[]{"Id", "Date", "gender", "QCStateLabel"},
738+
new String[]{"Id", "Date", "gender", "QCStateLabel", "performedby"},
722739
new Object[][]{
723-
{aliveAnimalId, LocalDateTime.now().minusDays(30), "f", "Completed"},
724-
{deadAnimalId, LocalDateTime.now().minusDays(30), "m", "Completed"},
725-
{departedAnimalId, LocalDateTime.now().minusDays(30), "m", "Completed"},
740+
{aliveAnimalId, LocalDateTime.now().minusDays(30), "f", "Completed", 1004},
741+
{deadAnimalId, LocalDateTime.now().minusDays(30), "m", "Completed", 1004},
742+
{departedAnimalId, LocalDateTime.now().minusDays(30), "m", "Completed", 1004},
726743
}
727744
), getExtraContext());
728745

729746
log("Inserting rows in assignments, protocolAssignment and housing");
730747
InsertRowsCommand protocol = new InsertRowsCommand("study", "protocolAssignment");
731-
protocol.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "protocol", "protocol101", "QCStateLabel", "Completed"));
748+
protocol.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "protocol", "protocol101", "QCStateLabel", "Completed", "performedby", 1004));
732749
protocol.execute(getApiHelper().getConnection(), getContainerPath());
733750

734751
InsertRowsCommand project = new InsertRowsCommand("study", "assignment");
735-
project.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "project", "640991", "QCStateLabel", "Completed"));
752+
project.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "project", "640991", "QCStateLabel", "Completed", "performedby", 1004));
736753
project.execute(getApiHelper().getConnection(), getContainerPath());
737754

738755
InsertRowsCommand housing = new InsertRowsCommand("study", "housing");
739-
housing.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "cage", "C4", "QCStateLabel", "Completed"));
756+
housing.addRow(Map.of("Id", aliveAnimalId, "date", LocalDateTime.now().minusDays(10), "cage", "C4", "QCStateLabel", "Completed", "performedby", 1004));
740757
housing.execute(getApiHelper().getConnection(), getContainerPath());
741758

742759
log("Marking an animal dead");
743760
InsertRowsCommand deaths = new InsertRowsCommand("study", "deaths");
744-
deaths.addRow(Map.of("Id", deadAnimalId, "date", LocalDateTime.now().minusDays(10), "reason", "4"));
761+
deaths.addRow(Map.of("Id", deadAnimalId, "date", LocalDateTime.now().minusDays(10), "reason", "4", "performedby", 1004));
745762
deaths.execute(getApiHelper().getConnection(), getContainerPath());
746763

747764
log("Marking an animal departed");
748765
InsertRowsCommand departure = new InsertRowsCommand("study", "departure");
749-
departure.addRow(Map.of("Id", departedAnimalId, "date", LocalDateTime.now().minusDays(1), "destination", "Oregon NPRC"));
766+
departure.addRow(Map.of("Id", departedAnimalId, "date", LocalDateTime.now().minusDays(1), "destination", "Oregon NPRC", "performedby", 1004));
750767
departure.execute(getApiHelper().getConnection(), getContainerPath());
751768
}
752769

0 commit comments

Comments
 (0)