<commit_before>class Result < ActiveRecord::Base
  belongs_to :submission
  has_many :marks
  has_many :extra_marks
  validates_presence_of :marking_state
  
  # calculate the total mark for this assignment
  def calculate_total
    marks = Mark.find_all_by_result_id(submission_id)
    extra_marks = ExtraMark.find_all_by_result_id(submission_id);
    total = 0;
    marks.each do |m|
     criterion = RubricCriteria.find(m.criterion.object_id)
     total = total + (criterion.weight * m.mark)
    end

    extra_marks.each do |em|
      total = total + em.mark
    end
  
    return total.to_f
  end
  
end<commit_msg>added schema for tables: results, marks and extra_marks<commit_after>class Result < ActiveRecord::Base
  belongs_to :submission
  has_many :marks
  has_many :extra_marks
  validates_presence_of :marking_state
  
  # calculate the total mark for this assignment
  def calculate_total
    marks = Mark.find_all_by_result_id(id)
    extra_marks = ExtraMark.find_all_by_result_id(id);
    total = 0;
    marks.each do |m|
     criterion = RubricCriteria.find(m.criterion)
     total = total + (criterion.weight * m.mark)
    end

    extra_marks.each do |em|
      total = total + em.mark
    end
  
    return total.to_f
  end
  
end
{'fraction_non_alphanumeric': 0.0728, 'fraction_numerical': 0.0016, 'mean_word_length': 3.3588850174216027, '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': '5272586', 'n_tokens_mistral': 428, 'n_tokens_neox': 423, 'n_words': 100}