<commit_before># require 'roar/decorator'
require 'roar/json/json_api'

class ScheduleExceptionRepresenter < Roar::Decorator
  include Roar::JSON

  property :id, render_nil: true
  property :type, exec_context: :decorator
  property :name, render_nil: true
  property :note
  nested :scope do
    property :starts_at, render_nil: true
    property :ends_at, render_nil: true
    property :faculty, render_nil: true
    property :semester, render_nil: true
    property :course_ids, render_nil: true, as: :courses
    property :timetable_slot_ids, render_nil: true, as: :timetable_slots
  end
  hash :options

  def type
    represented.exception_type.upcase
  end
end
<commit_msg>Add is_regular generated attribute to schedule exception API. Resolves #95.<commit_after># require 'roar/decorator'
require 'roar/json/json_api'

class ScheduleExceptionRepresenter < Roar::Decorator
  include Roar::JSON

  property :id, render_nil: true
  property :type, exec_context: :decorator
  property :name, render_nil: true
  property :note
  property :is_regular, exec_context: :decorator
  nested :scope do
    property :starts_at, render_nil: true
    property :ends_at, render_nil: true
    property :faculty, render_nil: true
    property :semester, render_nil: true
    property :course_ids, render_nil: true, as: :courses
    property :timetable_slot_ids, render_nil: true, as: :timetable_slots
  end
  hash :options

  def type
    represented.exception_type.upcase
  end

  def is_regular
    !represented.starts_at.present? && !represented.ends_at.present?
  end
end

{'fraction_non_alphanumeric': 0.08109833971902937, 'fraction_numerical': 0.001277139208173691, 'mean_word_length': 4.657039711191335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4620690', 'n_tokens_mistral': 517, 'n_tokens_neox': 498, 'n_words': 144}