<commit_before>require 'csv'

module ImportTopicsHelper
  def self.define_attributes(columns)
    attributes = {}
    attributes["topic_identifier"] = columns[0].strip
    attributes["topic_name"] = columns[1].strip
    attributes["max_choosers"] = columns[2].strip
    if columns.length > 5
      attributes["category"] = columns[3].strip
      attributes["description"] = columns[4].strip
      attributes["link"] = columns[5].strip
    end
  end

  def self.create_new_sign_up_topic(attributes, session)
    sign_up_topic = SignUpTopic.new(attributes)
    sign_up_topic.assignment_id = session[:assignment_id]
    sign_up_topic.save
    # sign_up_topic
  end
end<commit_msg>Split define attributes into two methods<commit_after>require 'csv'

module ImportTopicsHelper
  def self.define_attributes(columns)
    attributes = {}
    attributes["topic_identifier"] = columns[0].strip
    attributes["topic_name"] = columns[1].strip
    attributes["max_choosers"] = columns[2].strip
    attributes["category"] = columns[3].strip if columns.length > 3
    define_attributes_extra(attributes,columns);
    attributes
  end

  def self.define_attributes_extra(attributes,columns)
    attributes["description"] = columns[4].strip if columns.length > 4
    attributes["link"] = columns[5].strip if columns.length > 5
    attributes
  end

  def self.create_new_sign_up_topic(attributes, session)
    sign_up_topic = SignUpTopic.new(attributes)
    sign_up_topic.assignment_id = session[:assignment_id]
    sign_up_topic.save
    # sign_up_topic
  end
end
{'fraction_non_alphanumeric': 0.10594315245478036, 'fraction_numerical': 0.0103359173126615, 'mean_word_length': 4.592057761732852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '910946', 'n_tokens_mistral': 468, 'n_tokens_neox': 460, 'n_words': 85}