<commit_before>module Reservation
  class Resource < ActiveRecord::Base
    acts_as_tenant(:cluster)

    self.table_name = "resources"

    belongs_to :community
    has_and_belongs_to_many :shared_guidelines,
      class_name: "Reservation::SharedGuidelines",
      join_table: "reservation_guideline_inclusions"

    has_attached_file :photo,
      styles: { thumb: "220x165#" },
      default_url: "/images/missing/:style.png"
    validates_attachment_content_type :photo, content_type: /\Aimage\/jpeg/
    validates_attachment_file_name :photo, matches: /jpe?g\Z/i

    scope :meal_hostable, ->{ where("meal_abbrv IS NOT NULL") }
    scope :by_full_name, ->{ joins(:community).order("communities.abbrv, name") }
    scope :visible, ->{ where(hidden: false) }
    scope :hidden, ->{ where(hidden: true) }

    delegate :name, to: :community, prefix: true

    def full_name
      "#{community.abbrv} #{name}"
    end

    def full_meal_abbrv
      "#{community.abbrv} #{meal_abbrv}"
    end

    # Available reservation kinds. Returns nil if none are defined.
    def kinds
      (community.settings.reservations.kinds || "").split(/\s*,\s*/).presence
    end

    def has_guidelines?<commit_msg>4564: Fixed missing resource thumb image<commit_after>module Reservation
  class Resource < ActiveRecord::Base
    acts_as_tenant(:cluster)

    self.table_name = "resources"

    belongs_to :community
    has_and_belongs_to_many :shared_guidelines,
      class_name: "Reservation::SharedGuidelines",
      join_table: "reservation_guideline_inclusions"

    has_attached_file :photo,
      styles: { thumb: "220x165#" },
      default_url: "missing/resources/:style.png"
    validates_attachment_content_type :photo, content_type: /\Aimage\/jpeg/
    validates_attachment_file_name :photo, matches: /jpe?g\Z/i

    scope :meal_hostable, ->{ where("meal_abbrv IS NOT NULL") }
    scope :by_full_name, ->{ joins(:community).order("communities.abbrv, name") }
    scope :visible, ->{ where(hidden: false) }
    scope :hidden, ->{ where(hidden: true) }

    delegate :name, to: :community, prefix: true

    def full_name
      "#{community.abbrv} #{name}"
    end

    def full_meal_abbrv
      "#{community.abbrv} #{meal_abbrv}"
    end

    # Available reservation kinds. Returns nil if none are defined.
    def kinds
      (community.settings.reservations.kinds || "").split(/\s*,\s*/).presence
    end

    def has_guidelines?
{'fraction_non_alphanumeric': 0.12350761630300536, 'fraction_numerical': 0.006587072869493619, 'mean_word_length': 3.6462715105162524, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5917167', 'n_tokens_mistral': 837, 'n_tokens_neox': 789, 'n_words': 166}