Commit 24244912 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen
Browse files

Disable offset, users can wait

parent 43085cf0
Pipeline #5096 failed with stages
in 1 minute and 4 seconds
......@@ -146,7 +146,7 @@ def create_status_table
branch.counters.active.each do |counter|
next unless counter.source.is_a? Camera
is_ok = counter.status.where(date: date).pluck(:is_ok).first
image = is_ok ? '<img src="/images/green.png">' : '<img src="/images/red.png">'
image = is_ok ? '<img src="/images/green.png">' : '<img src="/images/red.png">'
status << image
end
row << "<td>#{status}</td>"
......@@ -320,13 +320,13 @@ get '/api/statistics/branch/:period_type/:branch_id' do
branch_list.each do |branch_id|
# TODO: the offset is an emergency solution as the page rendering started taking too long
# Come up with something more clever
offset = statistics_class.with_aggregate
#offset = statistics_class.with_aggregate
.where(aggregate_id: branch_list, aggregate_type: 'Branch')
.length
offset = offset < 365 ? 0 : offset - 365
#offset = offset < 365 ? 0 : offset - 365
results << statistics_class.with_aggregate
.where(aggregate_id: branch_list, aggregate_type: 'Branch')
.order(:date).offset(offset)
.order(:date)#.offset(offset)
branch = Branch.find(branch_id)
status_list << branch.get_recent_camera_status
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment