MOBILE-4362 workshop: Remove non-null assertions on index page

main
Pau Ferrer Ocaña 2023-10-11 15:29:59 +02:00
parent bbc107c1e0
commit f97ea19e9e
1 changed files with 27 additions and 28 deletions

View File

@ -13,15 +13,15 @@
[hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
</core-course-module-info> </core-course-module-info>
<ion-card *ngIf="phases"> <ion-card *ngIf="phases && workshop">
<ion-item button (click)="viewPhaseInfo()" detail="true"> <ion-item button (click)="viewPhaseInfo()" detail="true">
<ion-label> <ion-label>
<h2 class="ion-text-wrap">{{ phases[workshop!.phase].title }}</h2> <h2 class="ion-text-wrap">{{ phases[workshop.phase].title }}</h2>
</ion-label> </ion-label>
</ion-item> </ion-item>
<ng-container *ngIf="phases && phases[workshop!.phase] && phases[workshop!.phase].tasks && <ng-container *ngIf="phases && phases[workshop.phase] && phases[workshop.phase].tasks &&
phases[workshop!.phase].tasks.length"> phases[workshop.phase].tasks.length">
<ion-item button class="ion-text-wrap" *ngFor="let task of phases[workshop!.phase].tasks" <ion-item button class="ion-text-wrap" *ngFor="let task of phases[workshop.phase].tasks"
[class.item-dimmed]="task.code == 'submit' && !showSubmit" (click)="runTask(task)" detail="false"> [class.item-dimmed]="task.code == 'submit' && !showSubmit" (click)="runTask(task)" detail="false">
<ion-icon slot="start" name="far-circle" *ngIf="task.completed == null" <ion-icon slot="start" name="far-circle" *ngIf="task.completed == null"
[attr.aria-label]="'addon.mod_workshop.tasktodo' | translate"></ion-icon> [attr.aria-label]="'addon.mod_workshop.tasktodo' | translate"></ion-icon>
@ -45,7 +45,7 @@
</ion-card> </ion-card>
<!-- Description (setup phase only) --> <!-- Description (setup phase only) -->
<ion-card *ngIf="description && workshop && workshop!.phase == PHASE_SETUP"> <ion-card *ngIf="description && workshop && workshop.phase == PHASE_SETUP">
<ion-item class="ion-text-wrap"> <ion-item class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading">{{ 'core.description' | translate }}</h3> <h3 class="item-heading">{{ 'core.description' | translate }}</h3>
@ -56,14 +56,14 @@
</ion-item> </ion-item>
</ion-card> </ion-card>
<div *ngIf="access && workshop && workshop!.phase >= PHASE_SUBMISSION"> <div *ngIf="access && workshop && workshop.phase >= PHASE_SUBMISSION">
<!-- CLOSED PHASE --> <!-- CLOSED PHASE -->
<ng-container *ngIf="workshop!.phase >= PHASE_CLOSED"> <ng-container *ngIf="workshop.phase >= PHASE_CLOSED">
<ion-card *ngIf="workshop!.conclusion"> <ion-card *ngIf="workshop.conclusion">
<ion-item class="ion-text-wrap"> <ion-item class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading">{{ 'addon.mod_workshop.conclusion' | translate }}</h3> <h3 class="item-heading">{{ 'addon.mod_workshop.conclusion' | translate }}</h3>
<core-format-text collapsible-item [component]="component" [componentId]="module.id" [text]="workshop!.conclusion" <core-format-text collapsible-item [component]="component" [componentId]="module.id" [text]="workshop.conclusion"
contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId"> contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
</core-format-text> </core-format-text>
</ion-label> </ion-label>
@ -92,11 +92,11 @@
</ng-container> </ng-container>
<!-- SUBMISSION PHASE --> <!-- SUBMISSION PHASE -->
<ion-card *ngIf="workshop!.phase == PHASE_SUBMISSION && workshop!.instructauthors"> <ion-card *ngIf="workshop.phase == PHASE_SUBMISSION && workshop.instructauthors">
<ion-item class="ion-text-wrap"> <ion-item class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading">{{ 'addon.mod_workshop.areainstructauthors' | translate }}</h3> <h3 class="item-heading">{{ 'addon.mod_workshop.areainstructauthors' | translate }}</h3>
<core-format-text collapsible-item [component]="component" [componentId]="module.id" [text]="workshop!.instructauthors" <core-format-text collapsible-item [component]="component" [componentId]="module.id" [text]="workshop.instructauthors"
contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId"> contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
</core-format-text> </core-format-text>
</ion-label> </ion-label>
@ -106,10 +106,10 @@
<ion-card *ngIf="canSubmit"> <ion-card *ngIf="canSubmit">
<ion-item-divider class="ion-text-wrap"> <ion-item-divider class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading" *ngIf="workshop!.phase != PHASE_CLOSED || !submission"> <h3 class="item-heading" *ngIf="workshop.phase != PHASE_CLOSED || !submission">
{{ 'addon.mod_workshop.yoursubmission' | translate }} {{ 'addon.mod_workshop.yoursubmission' | translate }}
</h3> </h3>
<h3 class="item-heading" *ngIf="workshop!.phase == PHASE_CLOSED && submission"> <h3 class="item-heading" *ngIf="workshop.phase == PHASE_CLOSED && submission">
{{ 'addon.mod_workshop.yoursubmissionwithassessments' | translate }} {{ 'addon.mod_workshop.yoursubmissionwithassessments' | translate }}
</h3> </h3>
</ion-label> </ion-label>
@ -119,13 +119,13 @@
<p *ngIf="!submission">{{ 'addon.mod_workshop.noyoursubmission' | translate }}</p> <p *ngIf="!submission">{{ 'addon.mod_workshop.noyoursubmission' | translate }}</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
<addon-mod-workshop-submission *ngIf="submission" [submission]="submission" [courseId]="workshop!.course" [module]="module" <addon-mod-workshop-submission *ngIf="submission" [submission]="submission" [courseId]="workshop.course" [module]="module"
[workshop]="workshop" [access]="access"> [workshop]="workshop" [access]="access">
</addon-mod-workshop-submission> </addon-mod-workshop-submission>
</ion-card> </ion-card>
<ng-container *ngIf="workshop!.phase >= PHASE_CLOSED"> <ng-container *ngIf="workshop.phase >= PHASE_CLOSED">
<ion-card *ngIf="publishedSubmissions && publishedSubmissions.length"> <ion-card *ngIf="publishedSubmissions && publishedSubmissions.length">
<ion-item-divider class="ion-text-wrap"> <ion-item-divider class="ion-text-wrap">
<ion-label> <ion-label>
@ -133,7 +133,7 @@
</ion-label> </ion-label>
</ion-item-divider> </ion-item-divider>
<ng-container *ngFor="let submission of publishedSubmissions"> <ng-container *ngFor="let submission of publishedSubmissions">
<addon-mod-workshop-submission [submission]="submission" [courseId]="workshop!.course" [module]="module" <addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module"
[workshop]="workshop" [access]="access" summary="true" class="core-as-item"> [workshop]="workshop" [access]="access" summary="true" class="core-as-item">
</addon-mod-workshop-submission> </addon-mod-workshop-submission>
</ng-container> </ng-container>
@ -141,14 +141,13 @@
</ng-container> </ng-container>
<!-- ASSESSMENT PHASE --> <!-- ASSESSMENT PHASE -->
<ng-container *ngIf="workshop!.phase >= PHASE_ASSESSMENT"> <ng-container *ngIf="workshop.phase >= PHASE_ASSESSMENT">
<ion-card *ngIf="workshop!.phase == PHASE_ASSESSMENT && workshop!.instructreviewers"> <ion-card *ngIf="workshop.phase == PHASE_ASSESSMENT && workshop.instructreviewers">
<ion-item class="ion-text-wrap"> <ion-item class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading">{{ 'addon.mod_workshop.areainstructreviewers' | translate }}</h3> <h3 class="item-heading">{{ 'addon.mod_workshop.areainstructreviewers' | translate }}</h3>
<core-format-text collapsible-item [component]="component" [componentId]="module.id" <core-format-text collapsible-item [component]="component" [componentId]="module.id"
[text]="workshop!.instructreviewers" contextLevel="module" [contextInstanceId]="module.id" [text]="workshop.instructreviewers" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
[courseId]="courseId">
</core-format-text> </core-format-text>
</ion-label> </ion-label>
</ion-item> </ion-item>
@ -167,7 +166,7 @@
</ion-item> </ion-item>
<ng-container *ngFor="let assessment of (assessments || [])"> <ng-container *ngFor="let assessment of (assessments || [])">
<addon-mod-workshop-submission [submission]="assessment.submission" [assessment]="assessment" <addon-mod-workshop-submission [submission]="assessment.submission" [assessment]="assessment"
[courseId]="workshop!.course" [module]="module" [workshop]="workshop" [access]="access" summary="true" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"
class="core-as-item"> class="core-as-item">
</addon-mod-workshop-submission> </addon-mod-workshop-submission>
</ng-container> </ng-container>
@ -175,13 +174,13 @@
</ng-container> </ng-container>
<!-- MULTIPLE PHASES SUBMISSION OR GREATER only teachers --> <!-- MULTIPLE PHASES SUBMISSION OR GREATER only teachers -->
<ion-card *ngIf="access.canviewallsubmissions && workshop!.phase >= PHASE_SUBMISSION && <ion-card *ngIf="access.canviewallsubmissions && workshop.phase >= PHASE_SUBMISSION &&
((grades && grades.length) || (groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)))"> ((grades && grades.length) || (groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)))">
<ion-item-divider class="ion-text-wrap"> <ion-item-divider class="ion-text-wrap">
<ion-label> <ion-label>
<h3 class="item-heading" *ngIf="workshop!.phase == PHASE_SUBMISSION">{{ 'addon.mod_workshop.submissionsreport' | <h3 class="item-heading" *ngIf="workshop.phase == PHASE_SUBMISSION">{{ 'addon.mod_workshop.submissionsreport' |
translate }}</h3> translate }}</h3>
<h3 class="item-heading" *ngIf="workshop!.phase > PHASE_SUBMISSION">{{ 'addon.mod_workshop.gradesreport' | translate }} <h3 class="item-heading" *ngIf="workshop.phase > PHASE_SUBMISSION">{{ 'addon.mod_workshop.gradesreport' | translate }}
</h3> </h3>
</ion-label> </ion-label>
</ion-item-divider> </ion-item-divider>
@ -189,7 +188,7 @@
</core-group-selector> </core-group-selector>
<ng-container *ngFor="let submission of grades"> <ng-container *ngFor="let submission of grades">
<addon-mod-workshop-submission [submission]="submission" [courseId]="workshop!.course" [module]="module" <addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module"
[workshop]="workshop" [access]="access" summary="true" class="core-as-item"> [workshop]="workshop" [access]="access" summary="true" class="core-as-item">
</addon-mod-workshop-submission> </addon-mod-workshop-submission>
</ng-container> </ng-container>
@ -197,13 +196,13 @@
<ion-grid *ngIf="page > 0 || hasNextPage"> <ion-grid *ngIf="page > 0 || hasNextPage">
<ion-row class="ion-align-items-center"> <ion-row class="ion-align-items-center">
<ion-col *ngIf="page > 0"> <ion-col *ngIf="page > 0">
<ion-button expand="block" fill="outline" (click)="gotoSubmissionsPage(page! -1)"> <ion-button expand="block" fill="outline" (click)="gotoSubmissionsPage(page -1)">
<ion-icon name="fas-chevron-left" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-chevron-left" slot="start" aria-hidden="true"></ion-icon>
{{ 'core.previous' | translate }} {{ 'core.previous' | translate }}
</ion-button> </ion-button>
</ion-col> </ion-col>
<ion-col *ngIf="hasNextPage"> <ion-col *ngIf="hasNextPage">
<ion-button expand="block" (click)="gotoSubmissionsPage(page! + 1)"> <ion-button expand="block" (click)="gotoSubmissionsPage(page + 1)">
{{ 'core.next' | translate }} {{ 'core.next' | translate }}
<ion-icon name="fas-chevron-right" slot="end" aria-hidden="true"></ion-icon> <ion-icon name="fas-chevron-right" slot="end" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>