<commit_before>class Entry < ActiveRecord::Base

  def formatted_minutes
    "#{self.minutes / 60}: #{self.minutes % 60}"
  end

  def self.all_original(settings)

    settings.users.map {|name, attrs|
      if attrs['tracker'] == 'freckle'
        connect_to_freckle(attrs)

        records = LetsFreckle::Entry.find
        records = records.select { |r| r.project_id == attrs['credentials']['project_id'].to_i }
        records.map do |record|
          Entry.new(user: name,
                    date: record[:date],
                    original_minutes: record[:minutes],
                    minutes: record[:minutes],
                    original_id: record[:id], 
                    description: record[:description])
        end
      elsif attrs['tracker'] == 'tsv'
        CSV.read(attrs['path'], { :col_sep => "|" }).map do |line|
          next unless line[0]
          minutes = line[3].to_i
          from = Time.parse(line[1])
          Entry.new(user: name,
                    date: from.to_date,
                    original_minutes: minutes,
                    minutes: minutes + 15 - (minutes % 15),
                    original_id: line[0],<commit_msg>Dont skip line, just dont parse it<commit_after>class Entry < ActiveRecord::Base

  def formatted_minutes
    "#{self.minutes / 60}: #{self.minutes % 60}"
  end

  def self.all_original(settings)

    settings.users.map {|name, attrs|
      if attrs['tracker'] == 'freckle'
        connect_to_freckle(attrs)

        records = LetsFreckle::Entry.find
        records = records.select { |r| r.project_id == attrs['credentials']['project_id'].to_i }
        records.map do |record|
          Entry.new(user: name,
                    date: record[:date],
                    original_minutes: record[:minutes],
                    minutes: record[:minutes],
                    original_id: record[:id], 
                    description: record[:description])
        end
      elsif attrs['tracker'] == 'tsv'
        CSV.read(attrs['path'], { :col_sep => "|" }).map do |line|
          minutes = line[3].to_i
          from = Time.parse(line[1])
          Entry.new(user: name,
                    date: from.to_date,
                    original_minutes: minutes,
                    minutes: minutes + 15 - (minutes % 15),
                    original_id: line[0],
{'fraction_non_alphanumeric': 0.12868747327917915, 'fraction_numerical': 0.00983326207781103, 'mean_word_length': 1.8398058252427185, 'pattern_counts': {'":': 0, '<': 5, '<?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': '28000', 'n_tokens_mistral': 707, 'n_tokens_neox': 654, 'n_words': 142}