Skip to content

Commit

Permalink
LIMS-1368: Fix incorrectly summed dose for DC groups when filtered (#803
Browse files Browse the repository at this point in the history
)

* LIMS-1368: Fix incorrectly summed dose for DC groups when filtered

* LIMS-1368: Use correct total dose for data collection groups

---------

Co-authored-by: Mark Williams <[email protected]>
  • Loading branch information
ndg63276 and Mark Williams authored Sep 17, 2024
1 parent 55b05b3 commit 9a20f4c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function _data_collections($single = null)
dc.c2lens,
dc.objaperture,
dc.magnification,
dc.totalexposeddose as totaldose,
dose.total as totaldose,
CAST(dc.totalabsorbeddose AS DECIMAL(5, 2)) as totalabsdose,
d.detectorpixelsizehorizontal,
d.detectorpixelsizevertical,
Expand Down Expand Up @@ -574,7 +574,7 @@ function _data_collections($single = null)
max(dc.c2lens) as c2lens,
max(dc.objaperture) as objaperture,
max(dc.magnification) as magnification,
sum(dc.totalabsorbeddose) as totaldose,
dose.total as totaldose,
CAST(dc.totalabsorbeddose AS DECIMAL(5, 2)) as totalabsdose,
max(d.detectormanufacturer) as detectormanufacturer,
max(d.detectormodel) as detectormodel,
Expand Down Expand Up @@ -660,6 +660,9 @@ function _data_collections($single = null)
SELECT $extcg $fields
FROM datacollection dc
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN (
select datacollectiongroupid, sum(totalabsorbeddose) as total from datacollection group by datacollectiongroupid) dose
ON dc.datacollectiongroupid = dose.datacollectiongroupid
INNER JOIN blsession ses ON ses.sessionid = dcg.sessionid
LEFT OUTER JOIN experimenttype et on dcg.experimenttypeid = et.experimenttypeid
$sample_joins[0]
Expand Down

0 comments on commit 9a20f4c

Please sign in to comment.