Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-1235: Queries for implicit samples and DCs in project time out #758

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class DC extends Page
'sid' => '\d+',
'aid' => '\d+',
'pjid' => '\d+',
'imp' => '\d',
'pid' => '\d+',
'h' => '\d\d',
'dmy' => '\d\d\d\d\d\d\d\d',
Expand Down Expand Up @@ -71,7 +70,7 @@ class DC extends Page
# - a proposal /
# - a visit /visit/
# - a particular sample id /sid/
# - a project (explicit or implicit) /pjid/(imp/1/)
# - a project (explicit only) /pjid/
# - a protein /pid/
# Its also searchable (A-z0-9-/) and filterable
function _data_collections($single = null)
Expand Down Expand Up @@ -237,23 +236,11 @@ function _data_collections($single = null)
$extj[$i] .= " LEFT OUTER JOIN $t[0] prj ON $t[1].$t[2] = prj.$ct INNER JOIN proposal prop ON ses.proposalid = prop.proposalid";
$sess[$i] = 'prj.projectid=:' . ($i + 1);

if ($this->has_arg('imp')) {
if ($this->arg('imp')) {
$extj[$i] .= " LEFT OUTER JOIN crystal cr ON cr.crystalid = smp.crystalid LEFT OUTER JOIN protein pr ON pr.proteinid = cr.proteinid LEFT OUTER JOIN project_has_protein prj2 ON prj2.proteinid = pr.proteinid LEFT OUTER JOIN project_has_blsample prj3 ON prj3.blsampleid = smp.blsampleid";
$sess[$i] = '(prj.projectid=:' . ($i * 3 + 1) . ' OR prj2.projectid=:' . ($i * 3 + 2) . ' OR prj3.projectid=:' . ($i * 3 + 3) . ')';
}
}
}


$n = 4;
if ($this->has_arg('imp'))
if ($this->arg('imp'))
$n = 12;
for ($i = 0; $i < $n; $i++)
for ($i = 0; $i < 4; $i++)
array_push($args, $this->arg('pjid'));


# Proteins
} else if ($this->has_arg('pid')) {
$info = $this->db->pq("SELECT proteinid FROM protein p WHERE p.proteinid=:1", array($this->arg('pid')));
Expand Down
9 changes: 0 additions & 9 deletions api/src/Page/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Sample extends Page
'ty' => '\w+',
't' => '\w+',
'pjid' => '\d+',
'imp' => '\d',
'lt' => '\w+',
'existing_pdb' => '\d+',
'pdb_code' => '\w\w\w\w',
Expand Down Expand Up @@ -1035,14 +1034,6 @@ function _samples()

array_push($args, $this->user->personId);
}

if ($this->has_arg('imp')) {
if ($this->arg('imp')) {
array_push($args, $this->arg('pjid'));
$join .= ' LEFT OUTER JOIN project_has_protein pji ON pji.proteinid=pr.proteinid';
$where = preg_replace('/\(pj/', '(pji.projectid=:' . sizeof($args) . ' OR pj', $where);
}
}
}

# For a specific protein
Expand Down
27 changes: 4 additions & 23 deletions client/src/js/modules/projects/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ define(['marionette',
},

events: {
'click @ui.imp': 'toggleImplicit',
'keypress @ui.user': 'keypressUser',
},

ui: {
imp: 'a.imp',
user: 'input[name=adduser]',
},

Expand Down Expand Up @@ -71,33 +69,16 @@ define(['marionette',
this.users.queryParams.pjid = this.model.get('PROJECTID')
this.users.fetch()

this.implicit = 1

this.proteins = new Proteins(null, { queryParams: { pjid: this.model.get('PROJECTID'), imp: this.isImplicit.bind(this) }, state: { pageSize: 5 } })
this.proteins = new Proteins(null, { queryParams: { pjid: this.model.get('PROJECTID') }, state: { pageSize: 5 } })
this.proteins.fetch()

this.samples = new Samples(null, { queryParams: { pjid: this.model.get('PROJECTID'), imp: this.isImplicit.bind(this) }, state: { pageSize: 5 } })
this.samples = new Samples(null, { queryParams: { pjid: this.model.get('PROJECTID') }, state: { pageSize: 5 } })
this.samples.fetch()

this.dcs = new DCCol(null, { queryParams: { pjid: this.model.get('PROJECTID'), imp: this.isImplicit.bind(this), pp: 5 } })
this.dcs.fetch()
},


isImplicit: function() {
return this.implicit
},

toggleImplicit: function(e) {
e.preventDefault()
this.implicit = this.implicit ? 0 : 1
this.ui.imp.children('span').text(this.implicit ? 'Implicit' : 'Explicit')
this.proteins.fetch()
this.samples.fetch()
this.dcs = new DCCol(null, { queryParams: { pjid: this.model.get('PROJECTID'), pp: 5 } })
this.dcs.fetch()
},



getUsers: function(req, resp) {
var self = this
this.allusers.queryParams.s = req.term
Expand Down
2 changes: 0 additions & 2 deletions client/src/js/templates/projects/projectview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ <h1>Project Details</h1>

<p class="help">This pages shows details and history for the selected project</p>

<div class="ra"><a href="#" class="button imp" title="Click to change between showing explicity added project members and those implied by added proteins or samples"><i class="fa fa-arrows-alt"></i> <span>Implicit</span> Project Members</a></div>

<div class="form">
<ul>
<li>
Expand Down
Loading