Skip to content

Commit

Permalink
Cached manufacturer name between requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcam committed Jan 10, 2025
1 parent 9222a98 commit 8fc4fcc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
6 changes: 3 additions & 3 deletions data/templates/run_list.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<div class="roundborder">
<div>
<span class="page_title">Runs</span>
&middot;&middot;<a [%target %]href="[% SCRIPT_NAME %]/run/?id_run_status_dict=all&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[%id_instrument %]" [% IF !model.id_run_status_dict || model.id_run_status_dict == 'all' %]class="runs_active_selection"[% END %]>all</a>&middot;&middot;
&middot;&middot;<a [%target %]href="[% SCRIPT_NAME %]/run/?id_run_status_dict=all&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[%id_instrument %]&manufacturer=[% model.manufacturer %]" [% IF !model.id_run_status_dict || model.id_run_status_dict == 'all' %]class="runs_active_selection"[% END %]>all</a>&middot;&middot;
[% FOREACH rsd = model.current_run_status.run_status_dict.run_status_dicts_sorted -%]
&middot;&middot;<a [%target %]href="[% SCRIPT_NAME %]/run/?id_run_status_dict=[% rsd.id_run_status_dict %]&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[% id_instrument %]"><span class="npg_nbsp [% IF rsd.id_run_status_dict == model.id_run_status_dict %]runs_active_selection[% END %]">[% rsd.description %]</span></a>&middot;&middot;
&middot;&middot;<a [%target %]href="[% SCRIPT_NAME %]/run/?id_run_status_dict=[% rsd.id_run_status_dict %]&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[% id_instrument %]&manufacturer=[% model.manufacturer %]"><span class="npg_nbsp [% IF rsd.id_run_status_dict == model.id_run_status_dict %]runs_active_selection[% END %]">[% rsd.description %]</span></a>&middot;&middot;
[% END -%]
</div>
[% IF !id_instrument %]
Expand All @@ -25,7 +25,7 @@
<span class="medium_header ">Page: </span>
[% i = 0 %]
[% WHILE i * model.len < model.count_runs %]
&middot;<a [% target %][% IF i == model.start / model.len%]class="active" [% END %] href="[% SCRIPT_NAME %]/[% model.table %]?id_run_status_dict=[% model.id_run_status_dict %]&len=[% model.len %]&start=[% i * model.len %]&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[% id_instrument %]" id="pagination_[% i+1 %]">[% i+1 %]</a>&middot;
&middot;<a [% target %][% IF i == model.start / model.len%]class="active" [% END %] href="[% SCRIPT_NAME %]/[% model.table %]?id_run_status_dict=[% model.id_run_status_dict %]&len=[% model.len %]&start=[% i * model.len %]&id_instrument_format=[% model.id_instrument_format %]&id_instrument=[% id_instrument %]&manufacturer=[% model.manufacturer %]" id="pagination_[% i+1 %]">[% i+1 %]</a>&middot;
[% i = i + 1 %]
[% END %]
</div>
Expand Down
5 changes: 3 additions & 2 deletions t/20-view-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ my $util = t::util->new({fixtures => 1,});
REQUEST_METHOD => 'GET',
username => 'public',
util => $util,
cgi_params => {id_run_status_dict => 'all', id_instrument => 3, },
cgi_params => {id_run_status_dict => 'all', id_instrument => 3,},
});
ok($util->test_rendered($str, 't/data/rendered/run/runs_on_instrument.html'), 'html list render run instrument 3 all statuses');
ok($util->test_rendered($str, 't/data/rendered/run/runs_on_instrument.html'),
'html list render run instrument 3 all run statuses');
}

{
Expand Down
46 changes: 23 additions & 23 deletions t/data/rendered/run.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<div class="roundborder">
<div>
<span class="page_title">Runs</span>
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=all&id_instrument_format=all&id_instrument=" >all</a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=1&id_instrument_format=all&id_instrument="><span class="npg_nbsp runs_active_selection">run pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=3&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=2&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=22&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run stopped early</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=5&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run cancelled</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=4&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run complete</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=11&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run mirrored</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=6&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">analysis pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=21&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">data discarded</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=7&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">analysis in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=24&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">secondary analysis in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=8&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">analysis on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=10&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">analysis cancelled</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=9&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">analysis complete</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=19&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">qc review pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=26&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">qc in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=25&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">qc on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=17&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">archival pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=18&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">archival in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=12&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">run archived</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=20&id_instrument_format=all&id_instrument="><span class="npg_nbsp ">qc complete</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=all&id_instrument_format=all&id_instrument=&manufacturer=Illumina" >all</a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=1&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp runs_active_selection">run pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=3&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=2&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=22&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run stopped early</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=5&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run cancelled</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=4&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run complete</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=11&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run mirrored</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=6&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">analysis pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=21&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">data discarded</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=7&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">analysis in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=24&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">secondary analysis in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=8&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">analysis on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=10&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">analysis cancelled</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=9&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">analysis complete</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=19&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">qc review pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=26&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">qc in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=25&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">qc on hold</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=17&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">archival pending</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=18&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">archival in progress</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=12&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">run archived</span></a>&middot;&middot;
&middot;&middot;<a href="/cgi-bin/npg/run/?id_run_status_dict=20&id_instrument_format=all&id_instrument=&manufacturer=Illumina"><span class="npg_nbsp ">qc complete</span></a>&middot;&middot;
</div>

<div>
Expand All @@ -40,7 +40,7 @@
<div class="smaller_font_85">
<span class="medium_header ">Page: </span>

middot;<a class="active" href="/cgi-bin/npg/run?id_run_status_dict=1&len=40&start=0&id_instrument_format=all&id_instrument=" id="pagination_1" >1</a>&middot;
middot;<a class="active" href="/cgi-bin/npg/run?id_run_status_dict=1&len=40&start=0&id_instrument_format=all&id_instrument=&manufacturer=Illumina" id="pagination_1" >1</a>&middot;

</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions t/data/rendered/run/runs_on_instrument.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="roundborder">
<div>
<span class="page_title">Runs</span>
&middot;&middot;<a target="runs_on_instrument" href="/cgi-bin/npg/run/?id_run_status_dict=all&id_instrument_format=all&id_instrument=3" class="runs_active_selection">all</a>&middot;&middot;
# &middot;&middot;<a target="runs_on_instrument" href="/cgi-bin/npg/run/?id_run_status_dict=1&id_instrument_format=all&id_instrument=3">
&middot;&middot;<a target="runs_on_instrument" href="/cgi-bin/npg/run/?id_run_status_dict=all&id_instrument_format=all&id_instrument=3&manufacturer=Illumina" class="runs_active_selection">all</a>&middot;&middot;
# &middot;&middot;<a target="runs_on_instrument" href="/cgi-bin/npg/run/?id_run_status_dict=1&id_instrument_format=all&id_instrument=3&manufacturer=Illumina">
</div>

<div class="smaller_font_85">
<span class="medium_header ">Page: </span>
&middot;<a target="runs_on_instrument" class="active" href="/cgi-bin/npg/run?id_run_status_dict=all&len=40&start=0&id_instrument_format=all&id_instrument=3" id="pagination_1" >1</a>&middot;
&middot;<a target="runs_on_instrument" class="active" href="/cgi-bin/npg/run?id_run_status_dict=all&len=40&start=0&id_instrument_format=all&id_instrument=3&manufacturer=Illumina" id="pagination_1" >1</a>&middot;
</div>
</div>
<table id="runs" class="sortable zebra">
Expand Down

0 comments on commit 8fc4fcc

Please sign in to comment.