|
14 | 14 | import org.labkey.mcc.MccManager; |
15 | 15 |
|
16 | 16 | import java.util.Date; |
17 | | -import java.util.HashMap; |
18 | | -import java.util.Map; |
19 | 17 |
|
20 | 18 | /** |
21 | 19 | * User: bimber |
@@ -81,6 +79,7 @@ public String getMessageBodyHTML(Container c, User u) |
81 | 79 | doU24AssignedCheck(mccData, u , msg); |
82 | 80 | doMissingIdCheck(mccData, u, msg); |
83 | 81 | doZeroWeightCheck(mccData, u, msg); |
| 82 | + doDuplicationCheck(mccData, u, msg); |
84 | 83 |
|
85 | 84 | //since we dont want to trigger an email if there's no alerts, conditionally append the title |
86 | 85 | if (msg.length() > 0) |
@@ -174,4 +173,37 @@ protected void doParentSexCheck(final Container c, User u, final StringBuilder m |
174 | 173 | msg.append("<hr>\n\n"); |
175 | 174 | } |
176 | 175 | } |
| 176 | + |
| 177 | + protected void doDuplicationCheck(final Container c, User u, final StringBuilder msg) |
| 178 | + { |
| 179 | + TableInfo ti = getUserSchemaByName(c, u, "mcc").getTable("duplicateDemographics"); |
| 180 | + TableSelector ts = new TableSelector(ti); |
| 181 | + long count = ts.getRowCount(); |
| 182 | + if (count > 0) |
| 183 | + { |
| 184 | + msg.append("<b>WARNING: There are ").append(count).append(" demographics records with duplicated MCC IDs\n"); |
| 185 | + msg.append("<p><a href='").append(getExecuteQueryUrl(c, "mcc", "duplicateDemographics", null)).append("'>Click here to view them</a><br>\n\n"); |
| 186 | + msg.append("<hr>\n\n"); |
| 187 | + } |
| 188 | + |
| 189 | + ti = getUserSchemaByName(c, u, "mcc").getTable("duplicatedAggregatedDemographics"); |
| 190 | + ts = new TableSelector(ti); |
| 191 | + count = ts.getRowCount(); |
| 192 | + if (count > 0) |
| 193 | + { |
| 194 | + msg.append("<b>WARNING: There are ").append(count).append(" aggregated demographics records with duplicated MCC IDs\n"); |
| 195 | + msg.append("<p><a href='").append(getExecuteQueryUrl(c, "mcc", "duplicatedAggregatedDemographics", null)).append("'>Click here to view them</a><br>\n\n"); |
| 196 | + msg.append("<hr>\n\n"); |
| 197 | + } |
| 198 | + |
| 199 | + ti = getUserSchemaByName(c, u, "mcc").getTable("duplicatedAggregatedDemographicsParents"); |
| 200 | + ts = new TableSelector(ti); |
| 201 | + count = ts.getRowCount(); |
| 202 | + if (count > 0) |
| 203 | + { |
| 204 | + msg.append("<b>WARNING: There are ").append(count).append(" aggregated demographics parent records with duplicated MCC IDs\n"); |
| 205 | + msg.append("<p><a href='").append(getExecuteQueryUrl(c, "mcc", "duplicatedAggregatedDemographicsParents", null)).append("'>Click here to view them</a><br>\n\n"); |
| 206 | + msg.append("<hr>\n\n"); |
| 207 | + } |
| 208 | + } |
177 | 209 | } |
0 commit comments