<commit_before># Represents a generic announcement, which may be either a system-level or instance-level one.
class GenericAnnouncement
  include ActiveModel::Model

  # @return [Array<SystemAnnouncement|Instance::Announcement>]
  def self.currently_valid
    in_time_range = ['valid_from <= :now AND :now <= valid_to', {now: Time.zone.now}]
    system = SystemAnnouncement.includes(:creator).where(in_time_range).order(valid_from: :desc)
    instance = Instance::Announcement.includes(:creator).where(in_time_range).order(valid_from: :desc)
    system + instance
  end
end<commit_msg>Rewrote date query with squeel<commit_after># Represents a generic announcement, which may be either a system-level or instance-level one.
class GenericAnnouncement
  include ActiveModel::Model

  # @return [Array<SystemAnnouncement|Instance::Announcement>]
  def self.currently_valid
    now = Time.zone.now
    in_time_range = proc { (valid_from <= now) & (valid_to >= now) }
    system = SystemAnnouncement.includes(:creator).where(&in_time_range).order(valid_from: :desc)
    instance = Instance::Announcement.includes(:creator).where(&in_time_range).order(valid_from: :desc)
    system + instance
  end
end
{'fraction_non_alphanumeric': 0.11036789297658862, 'fraction_numerical': 0.0, 'mean_word_length': 5.687150837988827, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '3848441', 'n_tokens_mistral': 365, 'n_tokens_neox': 359, 'n_words': 83}