<commit_before>class Register_Course
  attr_accessor :configurations_hash, :configurations_array
  
  def initialize(course)
    @course = course
    generate_hash
    generate_array
  end

  #creates a hash of all the sections for this course
  def generate_hash
    @configurations_hash ||= {}
    @course.sections.each do |section|
      key = section.configuration_key
      @configurations_hash[key] ||= {}
      @configurations_hash[key][section.section_type] ||= []
      @configurations_hash[key][section.section_type] << section
    end
  end

  #creates an array of all the sections for this course
  #sorts based on array sizes
  def generate_array
    @configurations_array = @configurations_hash.sort_by{|k,config| config.length}
    for i in 0...@configurations_array.length
      @configurations_array[i] = @configurations_array[i][1].sort_by{|k,sections| sections.length}
      for j in 0...@configurations_array[i].length
        @configurations_array[i][j] = @configurations_array[i][j][1]
      end
    end
  end

end<commit_msg>sorting so earlier classes come first<commit_after>class Register_Course
  attr_accessor :configurations_hash, :configurations_array
  
  def initialize(course)
    @course = course
    generate_hash
    generate_array
  end

  #creates a hash of all the sections for this course
  def generate_hash
    @configurations_hash ||= {}
    @course.sections.each do |section|
      key = section.configuration_key
      @configurations_hash[key] ||= {}
      @configurations_hash[key][section.section_type] ||= []
      @configurations_hash[key][section.section_type] << section
    end
  end

  #creates an array of all the sections for this course
  #sorts based on array sizes
  def generate_array
    @configurations_array = @configurations_hash.sort_by{|k,config| config.length}
    for i in 0...@configurations_array.length
      @configurations_array[i] = @configurations_array[i][1].sort_by{|k,sections| sections.length}
      for j in 0...@configurations_array[i].length
        @configurations_array[i][j] = @configurations_array[i][j][1]
        @configurations_array[i][j].sort!{|x,y| x.start_time.to_i <=> y.start_time.to_i}
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.10276143051154368, 'fraction_numerical': 0.0036215482118605704, 'mean_word_length': 3.9220489977728286, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, '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': '4474738', 'n_tokens_mistral': 700, 'n_tokens_neox': 684, 'n_words': 153}