Skip to content

Commit 5a27165

Browse files
committed
Add check for duplicated MCC parent aliases
1 parent 032fa2b commit 5a27165

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
SELECT
2+
3+
m.originalDam as Id,
4+
GROUP_CONCAT(distinct m.dam, ',') as mccIds,
5+
'Dam' as category,
6+
GROUP_CONCAT(distinct m.colony, ',') as colonies
7+
8+
FROM mcc.aggregatedDemographics m
9+
WHERE m.dam IS NOT NULL
10+
GROUP BY m.originalDam
11+
HAVING COUNT(distinct m.dam) > 1
12+
13+
UNION ALL
14+
15+
SELECT
16+
17+
m.originalSire as Id,
18+
GROUP_CONCAT(distinct m.sire, ',') as mccIds,
19+
'Sire' as category,
20+
GROUP_CONCAT(distinct m.colony, ',') as colonies
21+
22+
FROM mcc.aggregatedDemographics m
23+
WHERE m.sire IS NOT NULL
24+
GROUP BY m.originalSire
25+
HAVING COUNT(distinct m.sire) > 1

mcc/src/org/labkey/mcc/MccMaintenanceTask.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ private void checkForDuplicateAliases(Logger log)
5858
log.error("The LDK module property BackgroundAdminUser must be set for the MCC Maintenance code to function");
5959
}
6060

61+
Container animalData = MccManager.get().getMCCContainer(ContainerManager.getRoot());
62+
if (animalData != null)
63+
{
64+
TableInfo ti = QueryService.get().getUserSchema(u, animalData, MccSchema.NAME).getTable("duplicatedAggregatedDemographicsParents");
65+
if (new TableSelector(ti).exists())
66+
{
67+
log.error("Duplicate MCC aliases for parents found. Please load the query mcc/duplicatedAggregatedDemographicsParents for more detail");
68+
}
69+
}
70+
6171
for (Study s : studies)
6272
{
6373
if (!s.getContainer().getActiveModules().contains(ModuleLoader.getInstance().getModule(MccModule.NAME)))

0 commit comments

Comments
 (0)