Skip to content

Commit efe94c2

Browse files
committed
Organize curator check display code
1 parent ea28363 commit efe94c2

4 files changed

Lines changed: 57 additions & 44 deletions

File tree

app/models/name/quality_checks.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,10 @@ def set
773773
@set_h.values.select(&:is_tutorial_error?)
774774
end
775775

776+
def [](type)
777+
@checks_h[type.to_sym]
778+
end
779+
776780
def checks
777781
@checks_h.values
778782
end
@@ -791,7 +795,7 @@ def resort!
791795
@set_h = {}
792796
@checks_h = {}
793797
QcWarning.defaults.each_key do |k|
794-
@set_h[k] = new_set_h[k] if new_set_h[k]
798+
@set_h[k] = new_set_h[k] if new_set_h[k]
795799
@checks_h[k] = new_checks_h[k] if new_checks_h[k]
796800
end
797801
end

app/views/checks/_curator.html.erb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<%
2+
warn_class =
3+
if !warn.check
4+
'check-skip'
5+
elsif warn.check.pass
6+
'check-pass'
7+
else
8+
'check-fail'
9+
end
10+
%>
11+
<dt class="<%= warn_class %>">
12+
<span class="check-links">
13+
<%= link_to('#', title: 'Skip',
14+
data: { do: 'skip', kind: warn.type }) do %>
15+
<%= fa_icon('minus-circle') %>
16+
<% end %>
17+
<%= link_to('#', title: 'Pass',
18+
data: { do: 'pass', kind: warn.type }) do %>
19+
<%= fa_icon('check-circle') %>
20+
<% end %>
21+
<%= link_to('#', title: 'Fail',
22+
data: { do: 'fail', kind: warn.type }) do %>
23+
<%= fa_icon('exclamation-circle') %>
24+
<% end %>
25+
</span>
26+
<span><%= warn.title %></span>
27+
</dt>
28+
<dd class="pb-2">
29+
<% if warn[:rules] || warn[:recommendations] || warn[:rule_notes] %>
30+
<%= warn[:message] %>
31+
<div class="text-muted">
32+
<b>§ SeqCode</b>:
33+
<% %w[rule rule_note recommendation].each do |section| %>
34+
<% warn[:"#{section}s"]&.each do |i| %>
35+
36+
<% text = name_of_seqcode_section(section, i) %>
37+
<%= link_to_seqcode_excerpt(section, i, text) %>
38+
<% end %>
39+
<% end %>
40+
</div>
41+
<% end %>
42+
</dd>

app/views/names/_curator_checks.html.erb

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -87,48 +87,7 @@
8787
<% first = false %>
8888
<% @name.qc_warnings.checks.each do |warn| %>
8989
<% next unless warn.checklist == section %>
90-
<%
91-
warn_class =
92-
if !warn.check
93-
'check-skip'
94-
elsif warn.check.pass
95-
'check-pass'
96-
else
97-
'check-fail'
98-
end
99-
%>
100-
<dt class="<%= warn_class %>">
101-
<span class="check-links">
102-
<%= link_to('#', title: 'Skip',
103-
data: { do: 'skip', kind: warn.type }) do %>
104-
<%= fa_icon('minus-circle') %>
105-
<% end %>
106-
<%= link_to('#', title: 'Pass',
107-
data: { do: 'pass', kind: warn.type }) do %>
108-
<%= fa_icon('check-circle') %>
109-
<% end %>
110-
<%= link_to('#', title: 'Fail',
111-
data: { do: 'fail', kind: warn.type }) do %>
112-
<%= fa_icon('exclamation-circle') %>
113-
<% end %>
114-
</span>
115-
<span><%= warn.title %></span>
116-
</dt>
117-
<dd class="pb-2">
118-
<% if warn[:rules] || warn[:recommendations] || warn[:rule_notes] %>
119-
<%= warn[:message] %>
120-
<div class="text-muted">
121-
<b>§ SeqCode</b>:
122-
<% %w[rule rule_note recommendation].each do |section| %>
123-
<% warn[:"#{section}s"]&.each do |i| %>
124-
125-
<% text = name_of_seqcode_section(section, i) %>
126-
<%= link_to_seqcode_excerpt(section, i, text) %>
127-
<% end %>
128-
<% end %>
129-
</div>
130-
<% end %>
131-
</dd>
90+
<%= render(partial: 'checks/curator', locals: { warn: warn }) %>
13291
<% end %>
13392
<% end %>
13493

app/views/registers/curation_genomics/_ambiguous_type_genome.html.erb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<%= pager(@names) %>
12
<table class="table table-hover table-responsive">
23
<thead>
34
<tr>
@@ -16,7 +17,13 @@
1617
<td><%= display_link(name) %></td>
1718
<td><%= display_link(genome) %></td>
1819
<td>
19-
<% name.qc_warnings.each do |warn| %>
20+
<%= render(
21+
'check/curator',
22+
locals: { warn: name.qc_warnings[@check] }
23+
) %>
24+
</td>
25+
<td>
26+
<% name.qc_warnings.checks.each do |warn| %>
2027
<% if warn.type.to_s =~ /^discrepant_/ %>
2128
<%= render(partial: 'checks/check', locals: { warn: warn }) %>
2229
<% end %>
@@ -28,3 +35,4 @@
2835
<% end %>
2936
</tbody>
3037
</table>
38+
<%= pager(@names) %>

0 commit comments

Comments
 (0)