You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20201116172038_populate_school_term_type_to_teaching_plans.rb
    path of file: ./repos/i-diario/db/migrate
    
    the code of the file until where you have to start completion: class PopulateSchoolTermTypeToTeachingPlans < ActiveRecord:
    
  def change
    TeachingPlan.find_each do |teaching_plan|
      school_term = teaching_plan.school_term

      if school_term.ends_with?('bimester')
        steps_number = 4
        step_number = case school_term
                      when 'first_bimester' then 1
                      when 'second_bimester' then 2
                      when 'third_bimester' then 3
                      else 4
                      end
      elsif school_term.ends_with?('eja') || school_term.ends_with?('semester')
        steps_number = 2
        step_number = case school_term
                      when 'first_bimester_eja' then 1
                      when 'first_semester' then 1
                      when 'second_bimester_eja' then 2
                      else 2
                      end