Refactored questionnaire_unique in assignment_analytic
Merged with Raheel's changes