File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,14 +204,24 @@ def endorse
204204
205205 # GET /registers/r:abc/prenotify
206206 def prenotify
207+ @errored ||= { }
207208 @genomes = @register . names . map ( &:type_genome ) . compact . select ( &:pending? )
208209 redirect_to ( notify_register_path ( @register ) ) if @genomes . empty?
209210 end
210211
211212 # POST /registers/r:abc/prenotify
212213 def prenotify_commit
214+ genomes = params . require ( :genome )
215+ @errored = { }
216+ genomes . each do |k , v |
217+ genome = Genome . find ( k )
218+ unless genome . update_accession ( v [ 'accession' ] , v [ 'database' ] )
219+ @errored [ k . to_i ] = 'Cannot update accession'
220+ end
221+ end
222+
213223 prenotify
214- render ( :prenotify )
224+ render ( :prenotify ) unless @genomes . empty?
215225 end
216226
217227 # GET /registers/r:abc/notify
Original file line number Diff line number Diff line change 2222 < th scope =col > Temporary designation</ th >
2323 < th scope =col > Database</ th >
2424 < th scope =col > Accession</ th >
25+ <% unless @errored . present? %>
26+ < th scope =col > Errors</ th >
27+ <% end %>
2528 </ tr >
2629 </ thead >
2730 < tbody >
3841 < td > <%= text_field_tag (
3942 "genome[#{ genome . id } ][accession]" , nil , class : 'form-control'
4043 ) %> </ td >
44+ <% if @errored [ genome . id ] %>
45+ < td class ="text-danger "> <%= @errored [ genome . id ] %> </ td >
46+ <% end %>
4147 </ tr >
4248 <% end %>
4349 </ tbody >
4955 < br /> < br />
5056<% end %>
5157
52- < pre >
53- <%= params . inspect %>
54- </ pre >
55-
You can’t perform that action at this time.
0 commit comments