Skip to content

Commit

Permalink
Merge pull request #2274 from vishnubansaltarento/kb-5608-5609-fix
Browse files Browse the repository at this point in the history
fill in the blank rendeing issue
  • Loading branch information
vishnubansaltarento authored Jul 6, 2024
2 parents ac14dca + 33192f4 commit e418718
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class FillInTheBlankComponent implements OnInit, OnChanges, AfterViewInit
let fromRichTextEditor = false
for (let i = 0; i < iterationNumber; i += 1) {
// tslint:disable-next-line
if(this.localQuestion.includes('/_______________/') ) {
if(this.localQuestion.includes('_______________') ) {
this.localQuestion = this.localQuestion.replace('_______________', 'idMarkerForReplacement')
} else if (this.localQuestion.includes('input style="border-style:none none solid none"')) {
// tslint:disable-next-line
Expand Down Expand Up @@ -216,7 +216,7 @@ export class FillInTheBlankComponent implements OnInit, OnChanges, AfterViewInit
functionChangeBlankBorder() {
if (this.question.questionType === 'ftb' && this.showAns) {
let iterationNumber: any = 0
if (this.localQuestion.includes('/_______________/')) {
if (this.localQuestion.includes('_______________')) {
iterationNumber = ((this.localQuestion.match(/_______________/g) || []).length)
} else if (this.localQuestion.includes('input style="border-style:none none solid none"')) {
iterationNumber = ((this.localQuestion.match(/input style="border-style:none none solid none"/g) || []).length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
(update)="update($event)"></viewer-mcq-sca-question>
</ng-container>
<ng-container *ngIf="question.questionType === 'mtf'">
<viewer-mtf-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"></viewer-mtf-question>
<viewer-mtf-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"
></viewer-mtf-question>
<div *ngIf="
viewState !== 'review' &&
numConnections &&
Expand Down Expand Up @@ -164,7 +165,8 @@
<div class="flex flex-1 viewer_quest_box">
<!-- {{log(question)}} -->
<ng-container>
<viewer-mtf-question class="flex-1" [question]="question" (update)="update($event)"></viewer-mtf-question>
<viewer-mtf-question class="flex-1" [question]="question" (update)="update($event)"
></viewer-mtf-question>
</ng-container>
</div>
</div>
Expand All @@ -182,7 +184,8 @@ <h2 [innerHTML]="question?.question" class="m-auto quiz-question mat-h2 flex-cen
</span>
</ng-container>
<ng-container *ngIf="question.questionType === 'ftb'">
<viewer-fitb-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"></viewer-fitb-question>
<viewer-fitb-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"
></viewer-fitb-question>
</ng-container>
</div>
</div>
Expand Down Expand Up @@ -227,7 +230,8 @@ <h2 [innerHTML]="question?.question" class="m-auto quiz-question mat-h2 flex-cen
</h2>
<ng-container *ngIf="question.questionType === 'ftb'">
<viewer-fitb-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question"
(update)="update($event)"></viewer-fitb-question>
(update)="update($event)"
></viewer-fitb-question>
</ng-container>
</div>
<div class="flex flex-1">
Expand All @@ -243,7 +247,8 @@ <h2 [innerHTML]="question?.question" class="m-auto quiz-question mat-h2 flex-cen
(update)="update($event)"></viewer-mcq-sca-question>
</ng-container>
<ng-container *ngIf="question.questionType === 'mtf'">
<viewer-mtf-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"></viewer-mtf-question>
<viewer-mtf-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"
></viewer-mtf-question>
<div *ngIf="
viewState !== 'review' &&
numConnections &&
Expand Down Expand Up @@ -301,7 +306,8 @@ <h2 [innerHTML]="question?.question" class="m-auto quiz-question mat-h2 flex-cen
<div class="flex flex-1 flex-column">
<div class="flex flex-1 viewer_quest_box">
<ng-container>
<viewer-mtf-question class="flex-1" [question]="question" (update)="update($event)"></viewer-mtf-question>
<viewer-mtf-question class="flex-1" [question]="question" (update)="update($event)"
></viewer-mtf-question>
</ng-container>
</div>
</div>
Expand All @@ -319,7 +325,8 @@ <h2 [innerHTML]="question?.question" class="m-auto quiz-question mat-h2 flex-cen
</span>
</ng-container>
<ng-container *ngIf="question.questionType === 'ftb'">
<viewer-fitb-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"></viewer-fitb-question>
<viewer-fitb-question [primaryCategory]="primaryCategory" class="flex-1" [question]="question" (update)="update($event)"
></viewer-fitb-question>
</ng-container>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,7 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy {
timeSpent: timeSpent.toString(),
editorState: { options: [] },
}

if (sq.options.length === 0 && this.questionAnswerHash[sq.questionId]) {
const ftbAns = this.questionAnswerHash[sq.questionId][0].split(',')
ftbAns.forEach((ans: string, index) => {
Expand All @@ -1313,6 +1314,14 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy {
selectedAnswer: ans,
})
})
} else if( this.questionAnswerHash[sq.questionId]) {
const ftbAns = this.questionAnswerHash[sq.questionId][0].split(',')
ftbAns.forEach((ans: string, index) => {
ftb.editorState.options.push({
index: index.toString(),
selectedAnswer: ans,
})
})
}
responseQ.push(ftb)
break
Expand Down

0 comments on commit e418718

Please sign in to comment.