app/models/questionnaire.rb
#calculate the percentage of completion of a questionnaire by a specific user
calculate the percentage of completion of a questionnaire by a specific user
calculate the percentage of completion of a questionnaire by a specific user
def percentage_of_completion_for user
    authorization = AuthorizedSubmitter.find_by_questionnaire_id_and_user_id(self.id, user.id)
    return 0.00 if authorization.answered_questions == 0 || authorization.total_questions == 0
    ( "%.2f" % ((authorization.answered_questions.to_f / authorization.total_questions.to_f) * 100) )
  end
def percentage_of_completion_for user authorization = AuthorizedSubmitter . find_by_questionnaire_id_and_user_id ( self . id , user . id ) return 0.00 if authorization . answered_questions == 0 || authorization . total_questions == 0 ( "%.2f" % ( ( authorization . answered_questions . to_f / authorization . total_questions . to_f ) * 100 ) ) end
calculate the percentage of completion of a questionnaire by a specific user
calculate the percentage of completion of a questionnaire by a specific user
user