diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index dd258d0ec..81957a2cb 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -167,7 +167,7 @@ class Sample extends Page array('/sub/:ssid', 'put', '_update_sub_sample_full'), array('/sub', 'post', '_add_sub_sample'), array('/sub/:ssid', 'delete', '_delete_sub_sample'), - array('/sub/queue/cid/:cid', 'get', '_queue_all_sub_samples'), + array('/sub/queue/cid/:cid', 'post', '_queue_all_sub_samples'), array('/sub/queue(/:BLSUBSAMPLEID)', 'get', '_pre_q_sub_sample'), array('/plan', 'get', '_get_diffraction_plans'), @@ -592,19 +592,23 @@ function _queue_all_sub_samples() } $args = array($this->proposalid, $this->arg('cid'), $this->arg('cid'), $this->arg('cid')); - $where = ' AND c.containerid=:2'; + $where = ' AND c.containerid=:2 AND cq2.completedtimestamp IS NULL'; $first_inner_select_where = ' AND s.containerid=:3'; $second_inner_select_where = ' AND s.containerid=:4'; $this->db->wait_rep_sync(true); $ss_query_string = $this->get_sub_samples_query($where, $first_inner_select_where, $second_inner_select_where); + $this->db->set_debug(True); $subs = $this->db->pq($ss_query_string, $args); + $this->db->set_debug(False); $this->db->wait_rep_sync(false); $ret = array(); foreach ($subs as $sub) { - array_push($ret, array('BLSUBSAMPLEID' => $sub['BLSUBSAMPLEID'], 'CONTAINERQUEUESAMPLEID' => $this->_do_pre_q_sample(array('BLSUBSAMPLEID' => $sub['BLSUBSAMPLEID'])))); + array_push($ret, array( + 'BLSUBSAMPLEID' => $sub['BLSUBSAMPLEID'], + 'CONTAINERQUEUESAMPLEID' => $this->_do_pre_q_sample(array('BLSUBSAMPLEID' => $sub['BLSUBSAMPLEID'])))); } $this->_output($ret); } diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js index 8d058d265..8c53dc5eb 100644 --- a/client/src/js/modules/imaging/views/queuecontainer.js +++ b/client/src/js/modules/imaging/views/queuecontainer.js @@ -567,20 +567,22 @@ define(['marionette', e.preventDefault() var self = this - + this.$el.addClass('loading'); Backbone.ajax({ url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), + method: "post", + data: {}, success: function(resp) { _.each(resp, function (r) { var ss = self.subsamples.fullCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) ss.set({ READYFORQUEUE: '1' }) }) }, - }) - - setTimeout(function() { - self.refreshQSubSamples.bind(self) - }, 1000) + complete: function(resp, status) { + self.$el.removeClass('loading') + self.refreshQSubSamples(self) + } + }) },