Skip to content
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
2 changes: 1 addition & 1 deletion snprc_ehr/resources/queries/study/animalDemographics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SELECT
d.species.arc_species_code as species,
CASE
WHEN h.cage is null THEN h.room
WHEN isnumeric(h.cage) = 1 THEN (h.room || '-' || cast(cast(h.cage as DECIMAL) as varchar) )
WHEN isnumeric(h.cage) THEN (h.room || '-' || cast(cast(h.cage as DECIMAL) as varchar) )
ELSE (h.room || '-' || h.cage)
END AS Location,
h.room as room,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
SELECT d2.id,
CASE
WHEN d2.cage is null THEN d2.room
WHEN isnumeric(d2.cage) = 1 THEN (d2.room || '-' || cast(cast(d2.cage as DECIMAL) as varchar) )
WHEN isnumeric(d2.cage) THEN (d2.room || '-' || cast(cast(d2.cage as DECIMAL) as varchar) )
ELSE (d2.room || '-' || d2.cage)
END AS Location,
d2.room.area, d2.room, d2.cage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
*/
Ext4.define("AnimalGroupsStore", {
extend: 'Ext.data.Store',
fields: ['code', 'categoryCode', 'name', {name: 'date', type: 'date', submitFormat: 'Y-m-d'}, {
name: 'endDate',
type: 'date',
submitFormat: 'Y-m-d'
}, 'comment', 'sortOrder'],
fields: ['code', 'categoryCode', 'name',
{name: 'date', type: 'date', dateReadFormat: 'Y-m-d', submitFormat: 'Y-m-d'},
{name: 'endDate', type: 'date', dateReadFormat: 'Y-m-d', submitFormat: 'Y-m-d' },
'comment', 'sortOrder'],
autoLoad: false,
proxy: {
type: 'ajax',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
if (mappedRows.get("code") != null && (Integer) mappedRows.get("code") != 0)
{
mappedRows.put("category_code", o.get("categoryCode"));
mappedRows.put("sort_order", o.get("sortOrder"));
mappedRows.put("sort_order", o.isNull("sortOrder") ? null : o.get("sortOrder"));

// update existing row
rowsList.add(mappedRows);
Expand All @@ -482,7 +482,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
//mappedRows.put("code", -1);
mappedRows.put("objectId", GUID.makeGUID());
mappedRows.put("category_code", o.get("categoryCode"));
mappedRows.put("sort_order", o.get("sortOrder"));
mappedRows.put("sort_order", o.isNull("sortOrder") ? null : o.get("sortOrder"));
rowsList.add(mappedRows);
qus.insertRows(getUser(), getContainer(), rowsList, batchErrors, null, null);
if (batchErrors.hasErrors()) throw batchErrors;
Expand Down
6 changes: 5 additions & 1 deletion snprc_ehr/src/org/labkey/snprc_ehr/domain/AnimalGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.json.JSONObject;
import org.labkey.api.data.Entity;
import org.labkey.api.util.DateUtil;

import java.util.Date;

Expand Down Expand Up @@ -111,6 +112,9 @@ public void setSortOrder(String sortOrder)

public JSONObject toJSON()
{
return new JSONObject(this);
JSONObject json = new JSONObject(this);
json.put("date", DateUtil.formatIsoDate(date));
json.put("endDate", DateUtil.formatIsoDate(endDate));
return json;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,34 @@ protected void initSND()

protected void createSNDCategories() throws CommandException, IOException
{
InsertRowsCommand command = new InsertRowsCommand("snd", "PkgCategories");
SelectRowsCommand selectCommand = new SelectRowsCommand("snd", "PkgCategories");
selectCommand.setColumns(List.of("Description"));
SelectRowsResponse response = selectCommand.execute(createDefaultConnection(), getProjectName());

List<String> existingCategories = new ArrayList<>();
for (Map<String, Object> row : response.getRows())
{
Object description = row.get("Description");
if (description != null)
existingCategories.add(String.valueOf(description));
}

InsertRowsCommand insertCommand = new InsertRowsCommand("snd", "PkgCategories");
boolean hasNewCategories = false;
for (String category : SND_CATEGORIES)
{
command.addRow(new HashMap<>(Maps.of(
if (existingCategories.contains(category))
continue;

insertCommand.addRow(new HashMap<>(Maps.of(
"Description", category,
"Active", true
)));
hasNewCategories = true;
}

command.execute(createDefaultConnection(), getProjectName());
if (hasNewCategories)
insertCommand.execute(createDefaultConnection(), getProjectName());
}

protected void createSNDPackages() throws Exception
Expand Down Expand Up @@ -617,7 +635,7 @@ protected void deleteRoomRecords() throws CommandException, IOException
@Override
protected void populateInitialData()
{
beginAt(WebTestHelper.getBaseURL() + "/SNPRC_EHR/" + getContainerPath() + "/populateData.view");
beginAt(WebTestHelper.buildURL("SNPRC_EHR", getContainerPath(), "populateData"));

repopulate("Lookup Sets");
repopulate("All");
Expand Down
Loading
Loading