<commit_before>class AddCardTypeToCard < ActiveRecord::Migration
  def fix_isic_card_number card
    return if !card.isic? || card.academic_year != Member.current_academic_year
    if !card.club.card_range_for(:isic).include?(card.number)
      card.number = nil
    end
  end

  def up
    add_column :cards, :card_type, :string
    Card.unscoped.find_each do |card|
      card.card_type = card.isic_status == 'none' ? 'fk' : 'isic'
      fix_isic_card_number card
      card.save(validate: false)
    end
    change_column :cards, :card_type, :text, null: false
  end

  def down
    remove_column :cards, :card_type
  end
end<commit_msg>Unscope member again, woop woop<commit_after>class AddCardTypeToCard < ActiveRecord::Migration
  def fix_isic_card_number card
    return if !card.isic? || card.academic_year != Member.current_academic_year
    Member.unscoped do
      if !card.club.card_range_for(:isic).include?(card.number)
        card.number = nil
      end
    end
  end

  def up
    add_column :cards, :card_type, :string
    Card.unscoped.find_each do |card|
      card.card_type = card.isic_status == 'none' ? 'fk' : 'isic'
      fix_isic_card_number card
      card.save(validate: false)
    end
    change_column :cards, :card_type, :text, null: false
  end

  def down
    remove_column :cards, :card_type
  end
end
{'fraction_non_alphanumeric': 0.09737827715355805, 'fraction_numerical': 0.0, 'mean_word_length': 3.4092409240924093, 'pattern_counts': {'":': 0, '<': 5, '<?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': '820153', 'n_tokens_mistral': 472, 'n_tokens_neox': 471, 'n_words': 106}