@@ -151,7 +151,7 @@ function _data_collections($single = null)
151151 $ where = " AND appm.autoprocprogrammessageid IS NOT NULL AND (appm.severity = 'WARNING' OR appm.severity = 'ERROR') " ;
152152 $ extj [0 ] .= "LEFT OUTER JOIN autoprocintegration api ON dc.datacollectionid = api.datacollectionid
153153 LEFT OUTER JOIN processingjob pj ON dc.datacollectionid = pj.datacollectionid
154- LEFT OUTER JOIN autoprocprogram app ON ( app.autoprocprogramid = api.autoprocprogramid OR dc.datacollectionid = pj.datacollectionid)
154+ LEFT OUTER JOIN autoprocprogram app ON app.autoprocprogramid = api.autoprocprogramid
155155 INNER JOIN autoprocprogrammessage appm ON appm.autoprocprogramid = app.autoprocprogramid " ;
156156 } else if ($ this ->arg ('t ' ) == "scrystal " || $ this ->arg ('t ' ) == "nscrystal " ) {
157157 // Single crystal or explicitly non-single-crystal fields
@@ -615,6 +615,7 @@ function _data_collections($single = null)
615615 $ groupby = "GROUP BY dc.datacollectiongroupid " ;
616616 }
617617
618+ // We don't want to remove duplicates, since if two counts are equal, one might go uncounted
618619 $ total_query = "SELECT sum(tot) as t FROM (
619620 $ with
620621 SELECT count( $ count_field) as tot
@@ -625,21 +626,21 @@ function _data_collections($single = null)
625626 $ extj [0 ]
626627 WHERE $ sess [0 ] $ where
627628
628- UNION SELECT count(es.energyscanid) as tot
629+ UNION ALL SELECT count(es.energyscanid) as tot
629630 FROM energyscan es
630631 INNER JOIN blsession ses ON ses.sessionid = es.sessionid
631632 $ sample_joins [1 ]
632633 $ extj [1 ]
633634 WHERE $ sess [1 ] $ where2
634635
635- UNION SELECT count(xrf.xfefluorescencespectrumid) as tot
636+ UNION ALL SELECT count(xrf.xfefluorescencespectrumid) as tot
636637 FROM xfefluorescencespectrum xrf
637638 INNER JOIN blsession ses ON ses.sessionid = xrf.sessionid
638639 $ sample_joins [3 ]
639640 $ extj [3 ]
640641 WHERE $ sess [3 ] $ where4
641642
642- UNION SELECT count(r.robotactionid) as tot
643+ UNION ALL SELECT count(r.robotactionid) as tot
643644 FROM robotaction r
644645 INNER JOIN blsession ses ON ses.sessionid = r.blsessionid
645646 $ sample_joins [2 ]
0 commit comments