-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
https://database.cosmin.nl/instruments
- Check server performance (atp)
- Improve query
instruments_controller.rb
...
@instruments, @alphaParams = Instrument.all
.alpha_paginate(params[:letter], {:default_field => '0-9', :include_all => false, :js => false, :bootstrap3 => true}) { |instrument| instrument.name }
@instruments.sort_by! { |m| m.name.downcase }
...
This queries all instruments in batches of 500 and then filters them. Slow.
views/instruments/index.html.erb
...
<td><%= instrument.records.count %></td>
...
<td>
<% if instrument.records.count == 0 %>
<%= link_to 'Delete', instrument, method: :delete, data: {confirm: 'Are you sure?'} %>
<% end %>
</td>
...
Results in 2 queries per row (although the second one is from cache). Also slow
- Use jquery datatables with paginated queries.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request