← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18481: Script

 

------------------------------------------------------------
revno: 18481
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-03-04 22:09:59 +0100
message:
  Script
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
  resources/sql/integritychecks.sql


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2015-03-04 21:09:59 +0000
@@ -127,7 +127,7 @@
 
     public DataElementCategoryCombo getCategoryCombo()
     {
-        return dataElements != null && dataElements.size() > 0 ? dataElements.iterator().next().getCategoryCombo() : null;
+        return dataElements != null && !dataElements.isEmpty() ? dataElements.iterator().next().getCategoryCombo() : null;
     }
 
     public boolean hasMultiDimensionalDataElement()

=== modified file 'resources/sql/integritychecks.sql'
--- resources/sql/integritychecks.sql	2015-02-19 18:23:12 +0000
+++ resources/sql/integritychecks.sql	2015-03-04 21:09:59 +0000
@@ -114,6 +114,16 @@
   and cco.categoryid=492298)
 where cco.sort_order is null;
 
+-- Identify sections where sort_order is wrong
+
+select ds.name as dataset, s.name as section, sd.sectionid, 
+max(sd.sort_order) as max_sort_order, count(distinct dataelementid) as dataelement_count
+from sectiondataelements sd
+inner join section s on sd.sectionid=s.sectionid
+inner join dataset ds on s.datasetid=ds.datasetid
+group by ds.name, s.name, sd.sectionid
+order by max(sd.sort_order) desc;
+
 -- Get category option combos from data values which are not part of the category combo of the data element
 
 select distinct de.name as data_element, dv.dataelementid, de_cc.name as data_element_category_combo, oc_cc.name as option_combo_category_combo, con.categoryoptioncomboname, dv.categoryoptioncomboid