forked from CIT/Vmeda.Online
		
	MOBILE-2431 question: Fix partially correct answers
This commit is contained in:
		
							parent
							
								
									517ed53327
								
							
						
					
					
						commit
						243fed2679
					
				| @ -18,7 +18,7 @@ | |||||||
| 
 | 
 | ||||||
|                 <!-- Input to enter the answer. --> |                 <!-- Input to enter the answer. --> | ||||||
|                 <ion-col> |                 <ion-col> | ||||||
|                     <ion-input padding-left type="text" placeholder="{{ 'core.question.answer' | translate }}" [attr.name]="question.input.name" [value]="question.input.value" [disabled]="question.input.readOnly" [ngClass]='{"core-question-answer-correct": question.input.isCorrect === 1, "core-question-answer-incorrect": question.input.isCorrect === 0}' autocorrect="off"> |                     <ion-input padding-left type="text" placeholder="{{ 'core.question.answer' | translate }}" [attr.name]="question.input.name" [value]="question.input.value" [disabled]="question.input.readOnly" [ngClass]="[question.input.correctClass]" autocorrect="off"> | ||||||
|                     </ion-input> |                     </ion-input> | ||||||
|                 </ion-col> |                 </ion-col> | ||||||
| 
 | 
 | ||||||
| @ -40,7 +40,7 @@ | |||||||
| <ng-template #selectUnits> | <ng-template #selectUnits> | ||||||
|     <ion-col> |     <ion-col> | ||||||
|         <label *ngIf="question.select.accessibilityLabel" class="accesshide" for="{{question.select.id}}">{{ question.select.accessibilityLabel }}</label> |         <label *ngIf="question.select.accessibilityLabel" class="accesshide" for="{{question.select.id}}">{{ question.select.accessibilityLabel }}</label> | ||||||
|         <ion-select id="{{question.select.id}}" [name]="question.select.name" [(ngModel)]="question.select.selected" interface="popover"> |         <ion-select id="{{question.select.id}}" [name]="question.select.name" [(ngModel)]="question.select.selected" interface="popover" [disabled]="question.select.disabled"> | ||||||
|             <ion-option *ngFor="let option of question.select.options" [value]="option.value">{{option.label}}</ion-option> |             <ion-option *ngFor="let option of question.select.options" [value]="option.value">{{option.label}}</ion-option> | ||||||
|         </ion-select> |         </ion-select> | ||||||
| 
 | 
 | ||||||
| @ -56,7 +56,7 @@ | |||||||
|             <ion-label> |             <ion-label> | ||||||
|                 <p>{{option.text}}</p> |                 <p>{{option.text}}</p> | ||||||
|             </ion-label> |             </ion-label> | ||||||
|             <ion-radio [value]="option.value" [disabled]="option.disabled"></ion-radio> |             <ion-radio [value]="option.value" [disabled]="option.disabled || question.input.readOnly"></ion-radio> | ||||||
|         </ion-item> |         </ion-item> | ||||||
| 
 | 
 | ||||||
|         <!-- ion-radio doesn't use an input. Create a hidden input to hold the selected value. --> |         <!-- ion-radio doesn't use an input. Create a hidden input to hold the selected value. --> | ||||||
|  | |||||||
| @ -2,6 +2,6 @@ | |||||||
|     <ion-item text-wrap> |     <ion-item text-wrap> | ||||||
|         <p><core-format-text [component]="component" [componentId]="componentId" [text]="question.text"></core-format-text></p> |         <p><core-format-text [component]="component" [componentId]="componentId" [text]="question.text"></core-format-text></p> | ||||||
|     </ion-item> |     </ion-item> | ||||||
|     <ion-input padding-left type="text" placeholder="{{ 'core.question.answer' | translate }}" [attr.name]="question.input.name" [value]="question.input.value" autocorrect="off" [disabled]="question.input.readOnly" [ngClass]='{"core-question-answer-correct": question.input.isCorrect === 1, "core-question-answer-incorrect": question.input.isCorrect === 0}'> |     <ion-input padding-left type="text" placeholder="{{ 'core.question.answer' | translate }}" [attr.name]="question.input.name" [value]="question.input.value" autocorrect="off" [disabled]="question.input.readOnly" [ngClass]="[question.input.correctClass]"> | ||||||
|     </ion-input> |     </ion-input> | ||||||
| </section> | </section> | ||||||
|  | |||||||
| @ -291,10 +291,12 @@ export class CoreQuestionBaseComponent { | |||||||
|             }; |             }; | ||||||
| 
 | 
 | ||||||
|             // Check if question is marked as correct.
 |             // Check if question is marked as correct.
 | ||||||
|             if (input.className.indexOf('incorrect') >= 0) { |             if (input.classList.contains('incorrect')) { | ||||||
|                 this.question.input.isCorrect = 0; |                 this.question.input.correctClass = 'core-question-incorrect'; | ||||||
|             } else if (input.className.indexOf('correct') >= 0) { |             } else if (input.classList.contains('correct')) { | ||||||
|                 this.question.input.isCorrect = 1; |                 this.question.input.correctClass = 'core-question-correct'; | ||||||
|  |             } else if (input.classList.contains('partiallycorrect')) { | ||||||
|  |                 this.question.input.correctClass = 'core-question-partiallycorrect'; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user