Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.53 KB | None | 0 0
  1.   def other_correct_rate
  2.     if school.present?
  3.       general_answer_count = general_statistics.answers_count
  4.       general_correct_count = general_statistics.correct_count
  5.  
  6.       other_answer_count =  general_answer_count - answers_count
  7.       other_correct_count = general_correct_count - correct_count
  8.  
  9.       (other_correct_count/other_answer_count.to_f)*100
  10.     else
  11.       nil
  12.     end
  13.   end
  14.  
  15.   def general_statistics
  16.     self.class.where(mock_id: mock_id, mock_question_id: mock_question_id, school_id: nil).first
  17.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement