sutty/app/models/access_log.rb

13 lines
581 B
Ruby
Raw Permalink Normal View History

2020-09-29 21:36:51 +00:00
# frozen_string_literal: true
class AccessLog < ApplicationRecord
2021-09-03 18:55:30 +00:00
# Las peticiones completas son las que terminaron bien y se
# respondieron con 200 OK o 304 Not Modified
#
# @see {https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
scope :completed_requests, -> { where(request_method: 'GET', request_completion: 'OK', status: [200, 304]) }
scope :non_robots, -> { where(crawler: false) }
scope :robots, -> { where(crawler: true) }
scope :pages, -> { where(sent_http_content_type: ['text/html', 'text/html; charset=utf-8', 'text/html; charset=UTF-8']) }
2020-09-29 21:36:51 +00:00
end