LMS: Fixed view for Quiz
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
		
							parent
							
								
									91bbe10495
								
							
						
					
					
						commit
						0d4135ec2b
					
				| @ -17,6 +17,11 @@ class Quiz(Document): | ||||
| 		pass | ||||
| 
 | ||||
| 
 | ||||
| 	def get_question(self): | ||||
| 		pass | ||||
| 	def get_questions(self): | ||||
| 		quiz_question = self.get_all_children() | ||||
| 		if quiz_question: | ||||
| 			questions = [frappe.get_doc('Question', question.question_link) for question in quiz_question] | ||||
| 			return questions | ||||
| 		else: | ||||
| 			return None | ||||
| 
 | ||||
|  | ||||
| @ -22,6 +22,11 @@ def get_context(context): | ||||
|         context.program_name = program_name | ||||
|         context.content_type = content_type | ||||
|         context.next_content_type, context.next_content = get_next_content(content_name, content_type, current_course.get_content_info()) | ||||
|         if content_type == "Quiz": | ||||
|             context.questions = current_content.get_questions() | ||||
|             print(content_type) | ||||
|             print(current_content.title) | ||||
|             print(context.questions) | ||||
| 
 | ||||
| def get_next_content(c_name, c_type, content_list): | ||||
|     try: | ||||
|  | ||||
| @ -1,15 +1,15 @@ | ||||
| {% macro quiz(loop_index, question) %} | ||||
| <div class="question mt-4" id="question['question']" data-question="{{ question['id'] }}"> | ||||
|     <h5>{{ loop_index }}{{ question['question'] }}</h5> | ||||
| <div class="question mt-4" id="{{ question.question }}" data-question="{{ question.name }}"> | ||||
|     <h5>{{ loop_index }}{{ question.question }}</h5> | ||||
|     <div class="options ml-2"> | ||||
|         <div class="form-check pb-1 hidden"> | ||||
|             <input class="form-check-input" type="radio" name="{{ question['id'] }}" value="0" checked> | ||||
|         </div> | ||||
|         {% for option in question['options'] %} | ||||
|         {% for option in question.options %} | ||||
|         <div class="form-check pb-1"> | ||||
|             <input class="form-check-input" type="radio" name="{{ question['id'] }}" id="{{loop_index}}-{{ option }}" value="{{ option }}"> | ||||
|             <label class="form-check-label" for="{{loop_index}}-{{ option }}"> | ||||
|                 {{ option }} | ||||
|             <input class="form-check-input" type="radio" name="{{ question.name }}" id="{{loop_index}}-{{ option.option }}" value="{{ option.option }}"> | ||||
|             <label class="form-check-label" for="{{loop_index}}-{{ option.option }}"> | ||||
|                 {{ option.option }} | ||||
|             </label> | ||||
|         </div> | ||||
|         {% endfor %} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user