From bbf9901775c6a53a96a8c34b3163d81af13ee017 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 23 Aug 2024 12:44:36 +0100 Subject: [PATCH 1/2] LIMS-1426: Allow setting of pipeline when ranking samples --- api/src/Page/Sample.php | 15 ++++++++++++++- .../modules/shipment/views/containerplate.js | 18 +++++++++++++++++- .../shipment/containerplateimage.html | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index c2fed8eeb..e456ba00f 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -43,6 +43,7 @@ class Sample extends Page 'capillaryPhase' => '', 'json' => '', 'dcp' => '\d', + 'pipeline' => '\w+', 'collected_during' => '\w+\d+-\d+', @@ -1152,7 +1153,19 @@ function _samples() $join WHERE $where", $args); $tot = intval($tot[0]['TOT']); - + # Get stats only for a specific processing pipeline + $pipelineids = array( + 3 => 'fast_dp', + 4 => 'xia2 (3dii|xds)', + 5 => 'xia2.multiplex', + 6 => 'xia2 dials', + 7 => 'xia2 3d', + 8 => 'autoPROC', + ); + if ($this->has_arg('pipeline')) { + $where .= ' AND (app.processingprograms is null or app.processingprograms REGEXP :' . (sizeof($args) + 1) . ')'; + array_push($args, $pipelineids[$this->arg('pipeline')]); + } $start = 0; $pp = $this->has_arg('per_page') ? $this->arg('per_page') : 15; diff --git a/client/src/js/modules/shipment/views/containerplate.js b/client/src/js/modules/shipment/views/containerplate.js index aa5fd157f..aa9540ef7 100644 --- a/client/src/js/modules/shipment/views/containerplate.js +++ b/client/src/js/modules/shipment/views/containerplate.js @@ -37,6 +37,7 @@ define(['marionette', 'modules/imaging/collections/autoscoreschemas', 'modules/imaging/collections/autoscores', 'collections/users', + 'collections/processingpipelines', 'utils/editable', 'views/table', @@ -75,7 +76,7 @@ define(['marionette', AutoScoreSchemas, AutoScores, Users, - + ProcessingPipelines, Editable, TableView, table, XHRImage, utils, template, templateimage){ @@ -260,6 +261,7 @@ define(['marionette', sampleStatusCurrent: 'input[id=sample_status_current]', param: 'select[name=param]', + pipeline: 'select[name=pipeline]', rank: 'input[name=rank]', sampleStatusAuto: 'input[id=sample_status_auto]', @@ -288,6 +290,7 @@ define(['marionette', 'click @ui.rank': 'setRankStatus', 'change @ui.param': 'setParamValue', + 'change @ui.pipeline': 'setPipeline', 'click @ui.sampleStatusAuto': 'setSampleStatusShown', 'change @ui.class': 'setAutoStatus', @@ -328,6 +331,11 @@ define(['marionette', this.setRankStatus() }, + setPipeline: function() { + this.samples.queryParams.pipeline = this.ui.pipeline.val() + this.samples.fetch({ data: {'sort_by': 'POSITION' } }) + }, + setRankStatus: function() { if (this.ui.rank.is(':checked')) { this.ui.sampleStatusData.prop('checked', true) @@ -652,9 +660,17 @@ define(['marionette', // Assumption all plates are for vmxi, so login => users only this.users.queryParams.login = 1 + this.processing_pipelines = new ProcessingPipelines() + this.processing_pipelines.queryParams.category = 'processing' + this.processing_pipelines.fetch().done(this.updatePipelines.bind(this)) + Backbone.Validation.bind(this) }, + updatePipelines: function() { + this.ui.pipeline.html(this.processing_pipelines.opts({ empty: true })) + }, + updateSchemas: function() { this.ui.schema.html(this.autoscoreschemas.opts()) this.selectSchema() diff --git a/client/src/js/templates/shipment/containerplateimage.html b/client/src/js/templates/shipment/containerplateimage.html index 028a8988d..872b2fa82 100644 --- a/client/src/js/templates/shipment/containerplateimage.html +++ b/client/src/js/templates/shipment/containerplateimage.html @@ -41,6 +41,7 @@

Container: <%-NAME%>

+
: