Skip to content

Commit 40c930b

Browse files
committed
Improve MCC data notification
1 parent ad9e92b commit 40c930b

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

mcc/src/org/labkey/mcc/ehr/MCCDepartureDataSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class MCCDepartureDataSource extends AbstractDataSource
3131
{
3232
public MCCDepartureDataSource(Module module)
3333
{
34-
super("study", "Departure", "Departure", "Transfers", module);
34+
super("study", "Departure", "Transfers", "Transfers", module);
3535
}
3636

3737
@Override

mcc/src/org/labkey/mcc/notification/MCCDataNotification.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public String getMessageBodyHTML(Container c, User u)
8080
doParentSexCheck(mccData, u, msg);
8181
doU24AssignedCheck(mccData, u , msg);
8282
doMissingIdCheck(mccData, u, msg);
83+
doZeroWeightCheck(mccData, u, msg);
8384

8485
//since we dont want to trigger an email if there's no alerts, conditionally append the title
8586
if (msg.length() > 0)
@@ -100,7 +101,22 @@ protected void doMissingIdCheck(final Container c, User u, final StringBuilder m
100101
if (count > 0)
101102
{
102103
msg.append("<b>WARNING: There are ").append(count).append(" animals missing MCC IDs\n");
103-
msg.append("<p><a href='").append(getExecuteQueryUrl(c, "study", "demographics", null)).append("&").append(filter.toQueryString("query")).append("'>Click here to view them</a><br>\n\n");
104+
msg.append("<p><a href='").append(getExecuteQueryUrl(c, "mcc", "aggregatedDemographics", null)).append("&").append(filter.toQueryString("query")).append("'>Click here to view them</a><br>\n\n");
105+
msg.append("<hr>\n\n");
106+
}
107+
}
108+
109+
protected void doZeroWeightCheck(final Container c, User u, final StringBuilder msg)
110+
{
111+
TableInfo ti = getUserSchemaByName(c, u, "mcc").getTable("aggregatedDemographics");
112+
113+
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("mostRecentWeight"), 0, CompareType.EQUAL);
114+
TableSelector ts = new TableSelector(ti, filter, null);
115+
long count = ts.getRowCount();
116+
if (count > 0)
117+
{
118+
msg.append("<b>WARNING: There are ").append(count).append(" animals listing weight as zero\n");
119+
msg.append("<p><a href='").append(getExecuteQueryUrl(c, "mcc", "aggregatedDemographics", null)).append("&").append(filter.toQueryString("query")).append("'>Click here to view them</a><br>\n\n");
104120
msg.append("<hr>\n\n");
105121
}
106122
}

0 commit comments

Comments
 (0)