<commit_before>class PlivoNumber < ActiveRecord::Base
  attr_accessible :number, :label, :start_time, :end_time, :business_time_zone
  has_many :number_attachements, uniq: true
  has_many :voice_mails
  def users
    User.joins(:plivo_numbers).where("plivo_number_id = ?", self.id).uniq
  end
  def groups
    Group.joins(:plivo_numbers).where("plivo_number_id = ?", self.id).uniq
  end

  def business_time?
    time_now = Time.use_zone(self.business_time_zone){Time.now}.localtime.change(day: 1, month: 1, year: 2000)
    start_time = Time.use_zone(self.business_time_zone){Time.zone.local_to_utc(self.start_time)}.localtime
    end_time = Time.use_zone(self.business_time_zone){Time.zone.local_to_utc(self.end_time)}.localtime
    if  start_time < time_now and time_now < end_time
      true
    else
      false
    end
  end

end<commit_msg>fix timezone<commit_after>class PlivoNumber < ActiveRecord::Base
  attr_accessible :number, :label, :start_time, :end_time, :business_time_zone
  has_many :number_attachements, uniq: true
  has_many :voice_mails
  def users
    User.joins(:plivo_numbers).where("plivo_number_id = ?", self.id).uniq
  end
  def groups
    Group.joins(:plivo_numbers).where("plivo_number_id = ?", self.id).uniq
  end

  def business_time?
    time_now = Time.now.change(day: 1, month: 1, year: 2000)
    offset = ActiveSupport::TimeZone.new(self.business_time_zone).utc_offset()
    start_time = self.start_time - offset
    end_time = self.end_time - offset
    if  start_time < time_now and time_now < end_time
      true
    else
      false
    end
  end

end
{'fraction_non_alphanumeric': 0.10628930817610063, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 4.250825082508251, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4301621', 'n_tokens_mistral': 591, 'n_tokens_neox': 568, 'n_words': 104}