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: 20130303094646_add_ignored_to_submission.rb
    path of file: ./repos/Autolab/db/migrate
    
    the code of the file until where you have to start completion: class AddIgnoredToSubmission < ActiveRecord::Migration[4.2]
  def self.up
    # NG => ignored
    add_column :submissions, :ignored, :boolean, :default => false, :null => false
    
  def self.calculate_latest_submissions(asmt_id, include_ignored)
    conditions = "assessment_id = #{asmt_id}"
    conditions << " AND ignored = FALSE" unless include_ignored

    max_version_subquery = "SELECT * FROM (SELECT MAX(version), user_id
                            FROM `submissions` WHERE #{conditions}
                            GROUP BY user_id) AS x"
    Submission.find(
      :all,
      :select => "submissions.*",
      :conditions => [ "(version, user_id) IN (#{max_version_subquery}) AND assessment_id = ?", asmt_id ],
    )
  end