From 91c20797d1d0e743e42131ad5afcb5cee21172af Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Mon, 15 Dec 2025 16:12:59 +0000 Subject: [PATCH 1/3] LIMS-2016: Only check snapshot images for data collections --- api/src/Page/DC.php | 10 +++++++--- client/src/js/modules/dc/dclist.js | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/api/src/Page/DC.php b/api/src/Page/DC.php index b3e0d4d22..3866aa8f5 100644 --- a/api/src/Page/DC.php +++ b/api/src/Page/DC.php @@ -1091,11 +1091,12 @@ function _chk_image() $where = array(); $ids = array(); + $args = array($this->proposalid); if ($this->has_arg('ids')) { if (is_array($this->arg('ids'))) { foreach ($this->arg('ids') as $i) { array_push($ids, $i); - array_push($where, 'dc.datacollectionid=:' . sizeof($ids)); + array_push($where, 'dc.datacollectionid=:' . (sizeof($ids)+1)); } } } @@ -1106,11 +1107,14 @@ function _chk_image() return; } + $args = array_merge($args, $ids); + $dct = $this->db->pq("SELECT CONCAT(p.proposalcode, p.proposalnumber, '-', s.visit_number) as vis, dc.datacollectionid as id, dc.startimagenumber, dc.filetemplate, dc.xtalsnapshotfullpath1 as x1, dc.xtalsnapshotfullpath2 as x2, dc.xtalsnapshotfullpath3 as x3, dc.xtalsnapshotfullpath4 as x4,dc.imageprefix as imp, dc.datacollectionnumber as run, dc.imagedirectory as dir, s.visit_number - FROM datacollection dc + FROM datacollection dc INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid INNER JOIN blsession s ON s.sessionid = dcg.sessionid - INNER JOIN proposal p ON p.proposalid = s.proposalid WHERE $where", $ids); + INNER JOIN proposal p ON p.proposalid = s.proposalid + WHERE p.proposalid=:1 AND $where", $args); $this->profile('dc query'); diff --git a/client/src/js/modules/dc/dclist.js b/client/src/js/modules/dc/dclist.js index 320f003ef..07ebb6f4c 100644 --- a/client/src/js/modules/dc/dclist.js +++ b/client/src/js/modules/dc/dclist.js @@ -1,6 +1,4 @@ define(['marionette', - //'modules/dc/views/imagestatuscollection', - //'modules/dc/views/apstatuscollection', 'modules/dc/collections/imagestatuses', 'modules/dc/collections/apstatuses', 'modules/dc/collections/apmessagestatuses', @@ -68,8 +66,10 @@ function(Marionette, }, _onSync: function() { - var ids = this.collection.pluck('ID') - this.imagestatuses.fetch({ data: { ids: ids }, type: 'POST' }) + var ids = this.collection + .filter(m => m.get('TYPE') === 'data' || m.get('TYPE') === 'grid') + .map(m => m.get('ID')); + if (ids.length) this.imagestatuses.fetch({ data: { ids: ids }, type: 'POST' }) if (this.getOption('apStatus')) this.apstatuses.fetch({ data: { ids: ids }, type: 'POST' }) if (this.getOption('apMessageStatus')) this.apmessagestatuses.fetch({ data: { ids: ids }, type: 'POST' }) }, From 7b226f3e5b6bbe15d497bc3e38dcb36e0a34b5f7 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Mon, 15 Dec 2025 16:46:20 +0000 Subject: [PATCH 2/3] LIMS-2016: Simplify proposal check --- api/src/Page/DC.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/src/Page/DC.php b/api/src/Page/DC.php index 3866aa8f5..cab2e0bf7 100644 --- a/api/src/Page/DC.php +++ b/api/src/Page/DC.php @@ -1091,12 +1091,11 @@ function _chk_image() $where = array(); $ids = array(); - $args = array($this->proposalid); if ($this->has_arg('ids')) { if (is_array($this->arg('ids'))) { foreach ($this->arg('ids') as $i) { array_push($ids, $i); - array_push($where, 'dc.datacollectionid=:' . (sizeof($ids)+1)); + array_push($where, 'dc.datacollectionid=:' . sizeof($ids)); } } } @@ -1107,14 +1106,14 @@ function _chk_image() return; } - $args = array_merge($args, $ids); + array_push($ids, $this->proposalid); + $where .= ' AND p.proposalid=:'.sizeof($ids); $dct = $this->db->pq("SELECT CONCAT(p.proposalcode, p.proposalnumber, '-', s.visit_number) as vis, dc.datacollectionid as id, dc.startimagenumber, dc.filetemplate, dc.xtalsnapshotfullpath1 as x1, dc.xtalsnapshotfullpath2 as x2, dc.xtalsnapshotfullpath3 as x3, dc.xtalsnapshotfullpath4 as x4,dc.imageprefix as imp, dc.datacollectionnumber as run, dc.imagedirectory as dir, s.visit_number FROM datacollection dc INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid INNER JOIN blsession s ON s.sessionid = dcg.sessionid - INNER JOIN proposal p ON p.proposalid = s.proposalid - WHERE p.proposalid=:1 AND $where", $args); + INNER JOIN proposal p ON p.proposalid = s.proposalid WHERE $where", $ids); $this->profile('dc query'); From b376a4a6a4bee4e2606c8261bdb1746c2c03c522 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Mon, 15 Dec 2025 17:23:47 +0000 Subject: [PATCH 3/3] LIMS-2016: Add fix for projects view --- api/src/Page/DC.php | 6 ++++-- client/src/js/modules/dc/dclist.js | 8 +++++++- client/src/js/modules/projects/views/view.js | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/api/src/Page/DC.php b/api/src/Page/DC.php index cab2e0bf7..4ab4da7d2 100644 --- a/api/src/Page/DC.php +++ b/api/src/Page/DC.php @@ -1106,8 +1106,10 @@ function _chk_image() return; } - array_push($ids, $this->proposalid); - $where .= ' AND p.proposalid=:'.sizeof($ids); + if (!$this->has_arg('pjid')) { + array_push($ids, $this->proposalid); + $where .= ' AND p.proposalid=:'.sizeof($ids); + } $dct = $this->db->pq("SELECT CONCAT(p.proposalcode, p.proposalnumber, '-', s.visit_number) as vis, dc.datacollectionid as id, dc.startimagenumber, dc.filetemplate, dc.xtalsnapshotfullpath1 as x1, dc.xtalsnapshotfullpath2 as x2, dc.xtalsnapshotfullpath3 as x3, dc.xtalsnapshotfullpath4 as x4,dc.imageprefix as imp, dc.datacollectionnumber as run, dc.imagedirectory as dir, s.visit_number FROM datacollection dc diff --git a/client/src/js/modules/dc/dclist.js b/client/src/js/modules/dc/dclist.js index 07ebb6f4c..19ca15a94 100644 --- a/client/src/js/modules/dc/dclist.js +++ b/client/src/js/modules/dc/dclist.js @@ -69,7 +69,13 @@ function(Marionette, var ids = this.collection .filter(m => m.get('TYPE') === 'data' || m.get('TYPE') === 'grid') .map(m => m.get('ID')); - if (ids.length) this.imagestatuses.fetch({ data: { ids: ids }, type: 'POST' }) + var data = { ids: ids } + var params = this.getOption('params') || {}; + if (params.pjid != null) { + data.pjid = params.pjid + } + if (!ids.length) return + this.imagestatuses.fetch({ data: data, type: 'POST' }) if (this.getOption('apStatus')) this.apstatuses.fetch({ data: { ids: ids }, type: 'POST' }) if (this.getOption('apMessageStatus')) this.apmessagestatuses.fetch({ data: { ids: ids }, type: 'POST' }) }, diff --git a/client/src/js/modules/projects/views/view.js b/client/src/js/modules/projects/views/view.js index d510b29df..441da3e94 100644 --- a/client/src/js/modules/projects/views/view.js +++ b/client/src/js/modules/projects/views/view.js @@ -105,7 +105,7 @@ define(['marionette', edit.create('ACRONYM', 'text') } - this.dc.show(new DCView({ model: this.model, collection: this.dcs, params: { visit: null }, noPageUrl: true, noFilterUrl: true, noSearchUrl: true })) + this.dc.show(new DCView({ model: this.model, collection: this.dcs, params: { visit: null, pjid: this.model.get('PROJECTID') }, noPageUrl: true, noFilterUrl: true, noSearchUrl: true })) this.smp.show(new SampleList({ collection: this.samples, noPageUrl: true, noFilterUrl: true, noSearchUrl: true })) this.prt.show(new ProteinList({ collection: this.proteins, noPageUrl: true, noSearchUrl: true }))