<commit_before>RSpec.describe QueueService, type: :service do
  time = Time.zone.parse("2016-07-18T08:00:00 #{Time.now.strftime("%z")}")

  def build(*args)
    FactoryGirl.build(*args)
  end

  before(:example) do    
    build(:team_1).save
    build(:service_1).save
    build(:qitem, created_at: time, closed: time + 10.seconds).save
    build(:qitem, created_at: time + 1.hour, closed: time + (1.hour + 10.seconds)).save
    build(:qitem, created_at: time + 2.hours, closed: time + (2.hours + 2.minutes)).save
    build(:qitem, created_at: time + 4.hours, closed: time + (4.hours + 20.seconds)).save
    build(:qitem, created_at: time + (4.hours + 15.minutes), closed: time + (4.hours + 20.minutes)).save
    build(:qitem, created_at: time + (5.hours + 59.minutes), closed: time + (6.hours + 30.seconds)).save
    build(:qitem, created_at: time + 7.hours, open: true).save
  end

  it "Correctly calculates average queue time" do
    expect(QueueService.new.average_queueing_duration('Helpdesk', '2016-07-17', '2016-07-19')).to eq(92)
  end

  it "Calculates number of people who entered queue by hour correctly" do
    expect(QueueService.new.queue_items_by_hour('Helpdesk', '2016-07-17', '2016-07-19')).to eq([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  end

  it "Calculates hourly average of queueing time correctly" do
    expect(QueueService.new.average_queueing_duration_by_hour('Helpdesk', time, time)).to eq([0, 0, 0, 0, 0, 0, 0, 0, 10.0, 10.0, 120.0, 0, 160.0, 90.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  end
end<commit_msg>remove hourly average queueing time<commit_after>RSpec.describe QueueService, type: :service do
  time = Time.zone.parse("2016-07-18T08:00:00 #{Time.now.strftime("%z")}")

  def build(*args)
    FactoryGirl.build(*args)
  end

  before(:example) do    
    build(:team_1).save
    build(:service_1).save
    build(:qitem, created_at: time, closed: time + 10.seconds).save
    build(:qitem, created_at: time + 1.hour, closed: time + (1.hour + 10.seconds)).save
    build(:qitem, created_at: time + 2.hours, closed: time + (2.hours + 2.minutes)).save
    build(:qitem, created_at: time + 4.hours, closed: time + (4.hours + 20.seconds)).save
    build(:qitem, created_at: time + (4.hours + 15.minutes), closed: time + (4.hours + 20.minutes)).save
    build(:qitem, created_at: time + (5.hours + 59.minutes), closed: time + (6.hours + 30.seconds)).save
    build(:qitem, created_at: time + 7.hours, open: true).save
  end

  it "Correctly calculates average queue time" do
    expect(QueueService.new.average_queueing_duration('Helpdesk', '2016-07-17', '2016-07-19')).to eq(92)
  end

  it "Calculates number of people who entered queue by hour correctly" do
    expect(QueueService.new.queue_items_by_hour('Helpdesk', '2016-07-17', '2016-07-19')).to eq([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  end  
end
{'fraction_non_alphanumeric': 0.1706896551724138, 'fraction_numerical': 0.08137931034482758, 'mean_word_length': 3.8756302521008403, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7468838', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1066, 'n_words': 288}