Skip to content

Commit

Permalink
handle for practice assessment attempt count 0 allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnubansaltarento committed Jul 13, 2024
1 parent 9e181d7 commit 5d0f975
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@
</div>
<div>
<div class="ml-5 start-assessment-cta-standalone block md:hidden" *ngIf="selectedAssessmentCompatibilityLevel >= 6">
<button [disabled]="!consentGiven ? 'disabled': null" *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview" [class.spinner]="loading" (click)="overviewed('start')" [ngClass]="consentGiven ? 'bg-blue-800 text-white' : 'secondary-standalone text-standalone-black'" class=" text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<button [disabled]="!consentGiven ? 'disabled': null" *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview || questionTYP.PRACTICE_RESOURCE == primaryCategory" [class.spinner]="loading" (click)="overviewed('start')" [ngClass]="consentGiven ? 'bg-blue-800 text-white' : 'secondary-standalone text-standalone-black'" class=" text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<span class="padding-xs" i18n>{{'playerbrief.startAssessment' | translate}}</span>
</button>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview && questionTYP.FINAL_ASSESSMENT === primaryCategory">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
</div>
</div>
</div>
<div class="start-assessment-cta hidden md:block" *ngIf="selectedAssessmentCompatibilityLevel >= 6">
<button [disabled]="!consentGiven ? 'disabled': null" *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview" [class.spinner]="loading" (click)="overviewed('start')" [ngClass]="consentGiven ? 'bg-blue-800 text-white' : 'secondary-standalone text-standalone-black'" class="text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<button [disabled]="!consentGiven ? 'disabled': null" *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview || questionTYP.PRACTICE_RESOURCE == primaryCategory" [class.spinner]="loading" (click)="overviewed('start')" [ngClass]="consentGiven ? 'bg-blue-800 text-white' : 'secondary-standalone text-standalone-black'" class="text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<span class="padding-xs" i18n>{{'playerbrief.startAssessment' | translate}}</span>
</button>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview && questionTYP.FINAL_ASSESSMENT === primaryCategory">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
</div>
<div class="start-assessment-cta hidden md:block" *ngIf="selectedAssessmentCompatibilityLevel < 6">
<button *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview" [class.spinner]="loading" [disabled]="loading" (click)="overviewed('start')" class="bg-blue-800 text-white text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<button *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || forPreview || questionTYP.PRACTICE_RESOURCE == primaryCategory" [class.spinner]="loading" [disabled]="loading" (click)="overviewed('start')" class="bg-blue-800 text-white text-sm font-semibold py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<span class="padding-xs" i18n>{{'playerbrief.startAssessment' | translate}}</span>
</button>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && !forPreview && questionTYP.FINAL_ASSESSMENT === primaryCategory">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
</div>

</div>
Expand Down Expand Up @@ -162,10 +162,10 @@ <h2 class="summary-label">{{ 'practiceoverview.summary' | translate }}</h2>

</div>
<div class="start-assessment-cta block md:hidden" *ngIf="selectedAssessmentCompatibilityLevel < 6">
<button *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed" [class.spinner]="loading" [disabled]="loading" (click)="overviewed('start')" class="bg-blue-800 text-sm font-semibold text-white py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<button *ngIf="canAttempt?.attemptsMade < canAttempt?.attemptsAllowed || questionTYP.PRACTICE_RESOURCE == primaryCategory" [class.spinner]="loading" [disabled]="loading" (click)="overviewed('start')" class="bg-blue-800 text-sm font-semibold text-white py-3 px-5 rounded-full border-none cursor-pointer tracking-wide">
<span class="padding-xs" i18n>{{'playerbrief.startAssessment' | translate}}</span>
</button>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
<mat-hint class="mat-title" *ngIf="canAttempt?.attemptsMade >= canAttempt?.attemptsAllowed && questionTYP.FINAL_ASSESSMENT === primaryCategory">{{'playerbrief.maxAllowedRetake' | translate}}</mat-hint>
</div>

<ng-template #detail let-icon="icon" let-text="text">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export class OverviewComponent implements OnInit, OnChanges, OnDestroy {

ngOnChanges() {
if (!this.forPreview) {
if (this.canAttempt && (this.canAttempt.attemptsMade >= this.canAttempt.attemptsAllowed)) {
if (this.canAttempt && (this.canAttempt.attemptsMade >= this.canAttempt.attemptsAllowed) &&
this.questionTYP.FINAL_ASSESSMENT === this.primaryCategory) {
if (!this.maxAttempPopup) {
this.showAssessmentPopup()
}

}
}

Expand Down
20 changes: 11 additions & 9 deletions project/ws/viewer/src/lib/plugins/practice/practice.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1638,15 +1638,17 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy {
if(this.selectedAssessmentCompatibilityLevel < 6) {
this.init()
} else {
this.quizSvc.canAttendV5(this.identifier).subscribe(response => {
if (response) {
this.canAttempt = response
// this.canAttempt = {
// attemptsAllowed: 1,
// attemptsMade: 0,
// }
}
})
if(this.ePrimaryCategory.FINAL_ASSESSMENT == this.primaryCategory) {
this.quizSvc.canAttendV5(this.identifier).subscribe(response => {
if (response) {
this.canAttempt = response
// this.canAttempt = {
// attemptsAllowed: 1,
// attemptsMade: 0,
// }
}
})
}
this.retakeAssessment()
}

Expand Down

0 comments on commit 5d0f975

Please sign in to comment.