Skip to content

Commit 5f43837

Browse files
committed
Resolve angular compiler errors
1 parent 4dcd2f6 commit 5f43837

28 files changed

Lines changed: 44 additions & 90 deletions

File tree

src/web/app/components/comment-box/comment-table/comment-table.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
<ul class="list-group list-group-flush" >
11-
@for (comment of model.commentRows; track trackByIndex(i, comment); let i = $index) {
11+
@for (comment of model.commentRows; track $index; let i = $index) {
1212
<li class="list-group-item">
1313
@if (comment.originalComment) {
1414
<tm-comment-row

src/web/app/components/comment-box/comment-table/comment-table.component.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,6 @@ export class CommentTableComponent {
108108
this.modelChange.emit({ ...this.model, [field]: data });
109109
}
110110

111-
/**
112-
* Tracks by index.
113-
*/
114-
trackByIndex(index: number): string {
115-
return index.toString();
116-
}
117-
118111
/**
119112
* Handles the close editing event.
120113
*/

src/web/app/components/question-response-panel/question-response-panel.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
<div id="question-{{ question.feedbackQuestion.questionNumber }}-responses" class="card bg-light mt-4">
1111
<div class="card-body">
1212
<tm-question-text-with-info [questionNumber]="question.feedbackQuestion.questionNumber" [questionDetails]="question.feedbackQuestion.questionDetails" class="question-text-with-info"></tm-question-text-with-info>
13-
@if (!question.hasResponseButNotVisibleForPreview,) {
13+
@if (!question.hasResponseButNotVisibleForPreview) {
1414
<div class="all-responses">
1515
@if (question.hasCommentNotVisibleForPreview) {
1616
<div class="alert alert-warning my-3 non-visible-comment-alert" role="alert">
1717
<i class="fas fa-eye-slash"></i> Some comments (on responses) received for this question are omitted from this preview because they are not visible to instructors, as per their visibility settings.
1818
</div>
1919
}
20-
@if (canUserSeeResponses(question),) {
20+
@if (canUserSeeResponses(question)) {
2121
<div class="other-responses">
2222
<tm-single-statistics [question]="question.feedbackQuestion.questionDetails"
2323
[responses]="question.allResponses"
2424
[statistics]="question.questionStatistics"
2525
[isStudent]="true"></tm-single-statistics>
26-
@if (RESPONSE_HIDDEN_QUESTIONS.includes(question.feedbackQuestion.questionType),) {
26+
@if (RESPONSE_HIDDEN_QUESTIONS.includes(question.feedbackQuestion.questionType)) {
2727
<div>
2828
<p style="color: gray; font-size: small;"><i class="fas fa-info-circle" style="color: #087CFC;"></i> Individual Responses are not configured to be shown for this question type.</p>
2929
</div>

src/web/app/components/question-responses/grq-rgq-view-responses/grq-rgq-view-responses.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h6 id="user-header" class="card-header bg-primary text-white cursor-pointer" ro
7676
<div @collapseAnim>
7777
<div class="card-body">
7878
@if (userHasRealResponses[userInfo]) {
79-
@for (last = last; track last = last) {
79+
@for (other of responsesToShow[userInfo] | keyvalue; track other.key; let isLast = $last) {
8080
<div id="grouped-responses" class="top-padded">
8181
<tm-grouped-responses [responses]="other.value"
8282
[isGrq]="isGrq" [session]="session"
@@ -86,7 +86,7 @@ <h6 id="user-header" class="card-header bg-primary text-white cursor-pointer" ro
8686
(updateCommentEvent)="triggerUpdateCommentEvent($event.responseId, $event.index)"
8787
(deleteCommentEvent)="triggerDeleteCommentEvent($event.responseId, $event.index)"
8888
(saveNewCommentEvent)="triggerSaveNewCommentEvent($event)"
89-
[isLastGroupedResponses]="last"></tm-grouped-responses>
89+
[isLastGroupedResponses]="isLast"></tm-grouped-responses>
9090
</div>
9191
}
9292
}

src/web/app/components/question-submission-form/question-submission-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h2 class="question-details"><b>Question {{ model.questionNumber }}: </b>{{ mode
9494
</div>
9595
}
9696
<div class="container">
97-
@for (recipientSubmissionFormModel of model.recipientSubmissionForms; track trackRecipientSubmissionFormByFn(i, recipientSubmissionFormModel); let i = $index) {
97+
@for (recipientSubmissionFormModel of model.recipientSubmissionForms; track $index; let i = $index) {
9898
<div class="row">
9999
<!-- When questions are grouped by recipients, only show the question edit answer form for that particular recipients-->
100100
@if (currentSelectedSessionView === allSessionViews.DEFAULT || (currentSelectedSessionView === allSessionViews.GROUP_RECIPIENTS && recipientId === recipientSubmissionFormModel.recipientIdentifier)) {

src/web/app/components/question-submission-form/question-submission-form.component.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,6 @@ export class QuestionSubmissionFormComponent implements DoCheck {
401401
this.updateSubmissionFormIndexes();
402402
}
403403

404-
/**
405-
* Tracks submission form for each recipient by the index in the array.
406-
*
407-
* @see https://angular.io/api/common/NgForOf#properties
408-
*/
409-
trackRecipientSubmissionFormByFn(index: number): any {
410-
return index;
411-
}
412-
413404
/**
414405
* Gets recipient name in {@code FIXED_RECIPIENT} mode.
415406
*/

src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="col-sm-6">
33
<div class="row">
44
<div id="options-section" cdkDropList (cdkDropListDropped)="onConstsumOptionDropped($event)" [cdkDropListDisabled]="!isEditable">
5-
@for (option of model.constSumOptions; track trackConstsumOption(i, option); let i = $index) {
5+
@for (option of model.constSumOptions; track $index; let i = $index) {
66
<div class="mb-3 d-flex" cdkDrag cdkDragLockAxis="y">
77
<div cdkDragHandle aria-hidden="true">
88
<span class="btn input-group-addon">&#8597; </span>

src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ export class ConstsumOptionsQuestionEditDetailsFormComponent
8080
this.triggerModelChange('constSumOptions', newOptions);
8181
}
8282

83-
/**
84-
* Tracks the Constsum option by index.
85-
*/
86-
trackConstsumOption(index: number): string {
87-
return index.toString();
88-
}
89-
9083
/**
9184
* Deletes a Constsum option.
9285
*/

src/web/app/components/question-types/question-edit-details-form/mcq-question-edit-details-form.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@if (!isGeneratedOptionsEnabled) {
3232
<div class="row">
3333
<div id="options-section" cdkDropList (cdkDropListDropped)="onMcqOptionDropped($event)" [cdkDropListDisabled]="!isEditable">
34-
@for (num of model.mcqChoices; track trackMcqOption(i, num); let i = $index) {
34+
@for (num of model.mcqChoices; track $index; let i = $index) {
3535
<div class="margin-top-22px d-flex" cdkDrag cdkDragLockAxis="y">
3636
<div cdkDragHandle aria-hidden="true">
3737
<span class="btn input-group-addon">&#8597;</span>
@@ -92,7 +92,7 @@
9292
<select id="generate-dropdown" class="form-control form-select" [disabled]="!isGeneratedOptionsEnabled || !isEditable"
9393
[ngModel]="model.generateOptionsFor" (ngModelChange)="triggerModelChange('generateOptionsFor', $event)" aria-label="Generate Option List Dropdown">
9494
@for (option of PARTICIPANT_TYPES; track option) {
95-
<option [value]="option">{{ option | generatedChoice }}</option>
95+
<option [ngValue]="option">{{ option | generatedChoice }}</option>
9696
}
9797
</select>
9898
</div>

src/web/app/components/question-types/question-edit-details-form/mcq-question-edit-details-form.component.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ import { GeneratedChoicePipe } from '../../teammates-common/generated-choice.pip
3131
export class McqQuestionEditDetailsFormComponent
3232
extends QuestionEditDetailsFormComponent<FeedbackMcqQuestionDetails> {
3333

34-
readonly PARTICIPANT_TYPES: string[] = [
34+
readonly PARTICIPANT_TYPES: FeedbackParticipantType[] = [
3535
FeedbackParticipantType.STUDENTS,
3636
FeedbackParticipantType.STUDENTS_EXCLUDING_SELF,
3737
FeedbackParticipantType.TEAMS,
3838
FeedbackParticipantType.TEAMS_EXCLUDING_SELF,
3939
FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF,
4040
FeedbackParticipantType.OWN_TEAM_MEMBERS,
4141
FeedbackParticipantType.INSTRUCTORS,
42-
];
42+
] as const;
4343

4444
// Used to store and restore user input when user toggles generate option
4545
storageModel: FeedbackMcqQuestionDetails = {
@@ -119,20 +119,6 @@ export class McqQuestionEditDetailsFormComponent
119119
this.triggerModelChange('mcqWeights', newWeights);
120120
}
121121

122-
/**
123-
* Tracks the Mcq option by index.
124-
*/
125-
trackMcqOption(index: number): string {
126-
return index.toString();
127-
}
128-
129-
/**
130-
* Tracks the Mcq weight by index.
131-
*/
132-
trackMcqWeight(index: number): string {
133-
return index.toString();
134-
}
135-
136122
/**
137123
* Triggers the display of the weight column for the Mcq options if weights option is checked/unchecked.
138124
*/

0 commit comments

Comments
 (0)