<commit_before>require 'bigdecimal'
require 'bigdecimal/util'

class Task < ActiveRecord::Base
  belongs_to :project
  validates :name, presence: true
  validates :date, presence: true
  validates :starttime, presence: true
  validates :endtime, presence: true
  attr_writer :date, :starttime, :endtime

  before_validation :set_date

  scope :between, ->(range) {
    from , to = range.split(' - ')
    where("? <= start_at and start_at <= ?", Time.parse(from), Time.parse(to)).order(:start_at)
  }

  def date
    @date || self.start_at.strftime('%Y-%m-%d') if self.start_at.present?
  end

  def starttime
    @starttime || self.start_at.strftime('%H:%M') if self.start_at.present?
  end

  def endtime
    @endtime || self.end_at.strftime('%H:%M') if self.end_at.present?
  end

  def set_date
    if @date && @starttime && @endtime
      self.start_at = Time.parse(@date + " " + @starttime)
      self.end_at   = Time.parse(@date + " " + @endtime)
    end
  end<commit_msg>blank check<commit_after>require 'bigdecimal'
require 'bigdecimal/util'

class Task < ActiveRecord::Base
  belongs_to :project
  validates :name, presence: true
  validates :date, presence: true
  validates :starttime, presence: true
  validates :endtime, presence: true
  attr_writer :date, :starttime, :endtime

  before_validation :set_date

  scope :between, ->(range) {
    from , to = range.split(' - ')
    where("? <= start_at and start_at <= ?", Time.parse(from), Time.parse(to)).order(:start_at)
  }

  def date
    @date || self.start_at.strftime('%Y-%m-%d') if self.start_at.present?
  end

  def starttime
    @starttime || self.start_at.strftime('%H:%M') if self.start_at.present?
  end

  def endtime
    @endtime || self.end_at.strftime('%H:%M') if self.end_at.present?
  end

  def set_date
    if @date.present? && @starttime.present? && @endtime.present?
      self.start_at = Time.parse(@date + " " + @starttime)
      self.end_at   = Time.parse(@date + " " + @endtime)
    end
  end
{'fraction_non_alphanumeric': 0.14840989399293286, 'fraction_numerical': 0.0, 'mean_word_length': 3.663529411764706, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '3991784', 'n_tokens_mistral': 717, 'n_tokens_neox': 700, 'n_words': 156}