app/controllers/reports_controller.rb
# Put server name and branch which you want to hide without waiting for 14 days
Put server name and branch which you want to hide without waiting for 14 days
Put server name and branch which you want to hide without waiting for 14 days
def current
    @use_opacity = true
    last = Report.last
    last_modified = last ? last.updated_at.utc : Time.at(0)
    interval = 600 
    margin = 30 
    expires_in (last_modified.to_i - Time.now.to_i + interval - margin) % interval
    if stale?(:last_modified => last_modified, :etag => last_modified.to_s, :public => true)
      @reports = Report.includes(:server).order('reports.branch DESC, servers.ordinal ASC, reports.option ASC').
        references(:server).
        where("reports.datetime > ?", 14.days.ago).
        where('reports.id IN (SELECT MAX(R.id) FROM reports R GROUP BY R.server_id, R.branch, R.option)').all
      @reports = @reports.to_a.delete_if{|report| report.server.nil? }
      @reports = filter_deprecated(@reports)
      render 'index'
    end
  end
def current @use_opacity = true last = Report . last last_modified = last ? last . updated_at . utc : Time . at ( 0 ) interval = 600 margin = 30 expires_in ( last_modified . to_i - Time . now . to_i + interval - margin ) % interval if stale? ( :last_modified => last_modified , :etag => last_modified . to_s , :public => true ) @reports = Report . includes ( :server ) . order ( 'reports.branch DESC, servers.ordinal ASC, reports.option ASC' ) . references ( :server ) . where ( "reports.datetime > ?" , 14 . days . ago ) . where ( 'reports.id IN (SELECT MAX(R.id) FROM reports R GROUP BY R.server_id, R.branch, R.option)' ) . all @reports = @reports . to_a . delete_if { | report | report . server . nil? } @reports = filter_deprecated ( @reports ) render 'index' end end
Put server name and branch which you want to hide without waiting for 14 days
Put server name and branch which you want to hide without waiting for 14 days
# cron interval # margin for cron's processing