From 9053c80ae0386730fa2b25e36c24413c59d39062 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 9 Apr 2025 17:32:28 +1000
Subject: [PATCH 01/14] feat: task definition toggle for tutorial enrolment
feature
---
src/app/api/models/task-definition.ts | 1 +
src/app/doubtfire-angular.module.ts | 2 +
.../task-definition-editor.component.html | 23 +++++++++++
...finition-tutorial-enrolment.component.html | 25 ++++++++++++
...finition-tutorial-enrolment.component.scss | 0
...definition-tutorial-enrolment.component.ts | 40 +++++++++++++++++++
6 files changed, 91 insertions(+)
create mode 100644 src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
create mode 100644 src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.scss
create mode 100644 src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
diff --git a/src/app/api/models/task-definition.ts b/src/app/api/models/task-definition.ts
index b848686768..f242f6837e 100644
--- a/src/app/api/models/task-definition.ts
+++ b/src/app/api/models/task-definition.ts
@@ -37,6 +37,7 @@ export class TaskDefinition extends Entity {
scormBypassTest: boolean;
scormTimeDelayEnabled: boolean;
scormAttemptLimit: number = 0;
+ tutorialSelfEnrolmentEnabled: boolean;
hasTaskAssessmentResources: boolean;
isGraded: boolean;
maxQualityPts: number;
diff --git a/src/app/doubtfire-angular.module.ts b/src/app/doubtfire-angular.module.ts
index a49f5f0bd9..49fdf82f2a 100644
--- a/src/app/doubtfire-angular.module.ts
+++ b/src/app/doubtfire-angular.module.ts
@@ -241,6 +241,7 @@ import {ScormExtensionCommentComponent} from './tasks/task-comments-viewer/scorm
import {ScormExtensionModalComponent} from './common/modals/scorm-extension-modal/scorm-extension-modal.component';
import { D2lTransferComponent, D2lTransferModal } from './units/states/portfolios/d2l-transfer-modal/d2l-transfer.component';
import { SuccessCloseComponent } from './common/success-close/success-close.component';
+import { TaskDefinitionTutorialEnrolmentComponent } from './units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component';
// See https://stackoverflow.com/questions/55721254/how-to-change-mat-datepicker-date-format-to-dd-mm-yyyy-in-simplest-way/58189036#58189036
const MY_DATE_FORMAT = {
@@ -296,6 +297,7 @@ const MY_DATE_FORMAT = {
TaskDefinitionResourcesComponent,
TaskDefinitionOverseerComponent,
TaskDefinitionScormComponent,
+ TaskDefinitionTutorialEnrolmentComponent,
UnitAnalyticsComponent,
StudentTutorialSelectComponent,
StudentCampusSelectComponent,
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-editor.component.html b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-editor.component.html
index 7d6224f343..23a834b98a 100644
--- a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-editor.component.html
+++ b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-editor.component.html
@@ -152,6 +152,29 @@
SCORM test
8
+
+
+ Tutorial enrolment form
+
+
+ Select the tutorial stream(s) that allow students to enrol in tutorials from
+
+
+
+
+
+
+
+
+
Optional settings
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
new file mode 100644
index 0000000000..352cf4021c
--- /dev/null
+++ b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
@@ -0,0 +1,25 @@
+
+
+ Enable tutorial self enrolment for task
+
+
+ @if (taskDefinition.tutorialSelfEnrolmentEnabled) {
+
+
+ Tutorial Streams - Which stream students can enrol into a tutorial from?
+
+ @for (stream of unit.tutorialStreams; track stream) {
+ {{ stream.name }} — ({{
+ stream.tutorialsIn(taskDefinition.unit).length
+ }}
+ tutorials)
+ }
+
+
+
+ }
+
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.scss b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
new file mode 100644
index 0000000000..4cd5e61ab7
--- /dev/null
+++ b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
@@ -0,0 +1,40 @@
+import {Component, Input, OnInit} from '@angular/core';
+import {FormControl, Validators} from '@angular/forms';
+import {AlertService} from 'src/app/common/services/alert.service';
+import {TaskDefinition} from 'src/app/api/models/task-definition';
+import {Unit} from 'src/app/api/models/unit';
+import {TaskDefinitionService} from 'src/app/api/services/task-definition.service';
+import {TutorialStream} from 'src/app/api/models/doubtfire-model';
+
+@Component({
+ selector: 'f-task-definition-tutorial-enrolment',
+ templateUrl: 'task-definition-tutorial-enrolment.component.html',
+ styleUrls: ['task-definition-tutorial-enrolment.component.scss'],
+})
+export class TaskDefinitionTutorialEnrolmentComponent implements OnInit {
+ @Input() taskDefinition: TaskDefinition;
+
+ public _tutorialStreams: TutorialStream[] = [];
+
+ public _selectedTutorialStreams: TutorialStream[] = [];
+
+ tutoralStreamControl = new FormControl
(null, Validators.required);
+
+ public ngOnInit(): void {
+ const tutorialStreams = this.taskDefinition.unit.tutorialStreamsCache.currentValues;
+ console.log(tutorialStreams);
+ for (const stream of tutorialStreams) {
+ console.log(stream);
+ this._tutorialStreams.push(stream);
+ }
+ }
+
+ constructor(
+ private alerts: AlertService,
+ private taskDefinitionService: TaskDefinitionService,
+ ) {}
+
+ public get unit(): Unit {
+ return this.taskDefinition?.unit;
+ }
+}
From 2b99b06b1b3e42ce42a30e3ec17491060dd3a4dd Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 15:38:50 +1000
Subject: [PATCH 02/14] feat: add task card to prompt tutorial enrolment
---
src/app/doubtfire-angular.module.ts | 2 +
src/app/doubtfire-angularjs.module.ts | 5 +++
...ask-tutorial-enrolment-card.component.html | 23 ++++++++++++
...ask-tutorial-enrolment-card.component.scss | 0
.../task-tutorial-enrolment-card.component.ts | 37 +++++++++++++++++++
.../task-dashboard/task-dashboard.tpl.html | 1 +
6 files changed, 68 insertions(+)
create mode 100644 src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
create mode 100644 src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.scss
create mode 100644 src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
diff --git a/src/app/doubtfire-angular.module.ts b/src/app/doubtfire-angular.module.ts
index 49fdf82f2a..886e54906a 100644
--- a/src/app/doubtfire-angular.module.ts
+++ b/src/app/doubtfire-angular.module.ts
@@ -236,6 +236,7 @@ import {ScormPlayerComponent} from './common/scorm-player/scorm-player.component
import {ScormAdapterService} from './api/services/scorm-adapter.service';
import {ScormCommentComponent} from './tasks/task-comments-viewer/scorm-comment/scorm-comment.component';
import {TaskScormCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-scorm-card/task-scorm-card.component';
+import {TaskTutorialEnrolmentCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component';
import {TestAttemptService} from './api/services/test-attempt.service';
import {ScormExtensionCommentComponent} from './tasks/task-comments-viewer/scorm-extension-comment/scorm-extension-comment.component';
import {ScormExtensionModalComponent} from './common/modals/scorm-extension-modal/scorm-extension-modal.component';
@@ -364,6 +365,7 @@ const MY_DATE_FORMAT = {
ScormPlayerComponent,
ScormCommentComponent,
TaskScormCardComponent,
+ TaskTutorialEnrolmentCardComponent,
ScormExtensionCommentComponent,
ScormExtensionModalComponent,
],
diff --git a/src/app/doubtfire-angularjs.module.ts b/src/app/doubtfire-angularjs.module.ts
index c7b5c2502c..38bb182138 100644
--- a/src/app/doubtfire-angularjs.module.ts
+++ b/src/app/doubtfire-angularjs.module.ts
@@ -225,6 +225,7 @@ import {MarkedPipe} from './common/pipes/marked.pipe';
import {AlertService} from './common/services/alert.service';
import {GradeService} from './common/services/grade.service';
import {TaskScormCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-scorm-card/task-scorm-card.component';
+import {TaskTutorialEnrolmentCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component';
import { D2lUnitDetailsModal } from './units/states/edit/directives/unit-details-editor/d2l-details-form/d2l-unit-details-form.component';
import { D2lTransferModal } from './units/states/portfolios/d2l-transfer-modal/d2l-transfer.component';
@@ -370,6 +371,10 @@ DoubtfireAngularJSModule.directive(
'fTaskScormCard',
downgradeComponent({component: TaskScormCardComponent}),
);
+DoubtfireAngularJSModule.directive(
+ 'fTaskTutorialEnrolmentCard',
+ downgradeComponent({component: TaskTutorialEnrolmentCardComponent}),
+);
DoubtfireAngularJSModule.directive(
'fTaskStatusCard',
downgradeComponent({component: TaskStatusCardComponent}),
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
new file mode 100644
index 0000000000..bf2ae8a4b9
--- /dev/null
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
@@ -0,0 +1,23 @@
+@if (!isSubmitted) {
+
+
+ Tutorial Enrolment
+
+
+
+ This task allows you to select a tutorial to enrol in for the semester. Depending on which
+ tutorial you pick from, you will be assigned to the corresponding tutor that will mark your
+ work throughout the teaching period.
+
+ To complete this task, you must enrol into a tutorial from the provided list.
+
+
+
+
+ launch
+
+ Begin enrolment
+
+
+
+}
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.scss b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
new file mode 100644
index 0000000000..9ce0a846ff
--- /dev/null
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -0,0 +1,37 @@
+import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
+import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
+
+@Component({
+ selector: 'f-task-tutorial-enrolment-card',
+ templateUrl: './task-tutorial-enrolment-card.component.html',
+ styleUrls: ['./task-tutorial-enrolment-card.component.scss'],
+})
+export class TaskTutorialEnrolmentCardComponent implements OnChanges {
+ @Input() task: Task;
+ user: User;
+ isSubmitted: boolean; // task submitted and student enrolled in tutorial
+ tutorialEnrolmentEnabled: boolean;
+
+ constructor(private userService: UserService) {
+ this.user = this.userService.currentUser;
+ this.tutorialEnrolmentEnabled = true; // debug
+ }
+
+ ngOnChanges(changes: SimpleChanges) {
+ if (
+ changes.task &&
+ changes.task.currentValue &&
+ changes.task.currentValue.definition.tutorialSelfEnrolmentEnabled
+ ) {
+ console.log('self enrolment feature is enabled for this task'); // debug
+ }
+ }
+
+ isNotStudent(): boolean {
+ return this.user !== this.task.project.student;
+ }
+
+ launchTutorialEnrolment(): void {
+ console.log('launching tutorial enrolment...'); // debug
+ }
+}
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html b/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
index d2797fa663..7a4b783d16 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
@@ -42,6 +42,7 @@
+
From 2cbb3d9287ad80222ddb6b6739f774d4198d52b3 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 15:40:07 +1000
Subject: [PATCH 03/14] fix: typo
---
.../dashboard/directives/task-dashboard/task-dashboard.tpl.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html b/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
index 7a4b783d16..fc341f0c61 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/task-dashboard.tpl.html
@@ -42,7 +42,7 @@
-
+
From c02d8a1c1efac5e21d124fc42c1b1a91a2193c32 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 15:52:41 +1000
Subject: [PATCH 04/14] chore: improve wording
---
.../task-tutorial-enrolment-card.component.html | 7 +++----
.../task-tutorial-enrolment-card.component.ts | 7 +++++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
index bf2ae8a4b9..a50093fd92 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
@@ -5,11 +5,10 @@
- This task allows you to select a tutorial to enrol in for the semester. Depending on which
- tutorial you pick from, you will be assigned to the corresponding tutor that will mark your
- work throughout the teaching period.
+ This task lets you choose a tutorial to enrol in for the semester. Your selected tutorial
+ will determine which tutor is assigned to mark your work throughout the teaching period.
- To complete this task, you must enrol into a tutorial from the provided list.
+ To complete this task, you must enrol in a tutorial from the provided list.
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index 9ce0a846ff..46a1d5c213 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -1,4 +1,4 @@
-import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
+import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
@Component({
@@ -6,7 +6,7 @@ import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
templateUrl: './task-tutorial-enrolment-card.component.html',
styleUrls: ['./task-tutorial-enrolment-card.component.scss'],
})
-export class TaskTutorialEnrolmentCardComponent implements OnChanges {
+export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
@Input() task: Task;
user: User;
isSubmitted: boolean; // task submitted and student enrolled in tutorial
@@ -14,6 +14,9 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges {
constructor(private userService: UserService) {
this.user = this.userService.currentUser;
+ }
+
+ ngOnInit(): void {
this.tutorialEnrolmentEnabled = true; // debug
}
From 7f7775028db1333a9c631ed22a02a0dbae225885 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 16:47:14 +1000
Subject: [PATCH 05/14] feat: add tutorial enrolment modal
---
.../tutorial-enrolment-modal.component.html | 29 +++++++++++
.../tutorial-enrolment-modal.component.ts | 52 +++++++++++++++++++
.../tutorial-enrolment-modal.service.ts | 24 +++++++++
src/app/doubtfire-angular.module.ts | 2 +
.../task-tutorial-enrolment-card.component.ts | 7 ++-
5 files changed, 113 insertions(+), 1 deletion(-)
create mode 100644 src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
create mode 100644 src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
create mode 100644 src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service.ts
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
new file mode 100644
index 0000000000..2bc2a8054b
--- /dev/null
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
@@ -0,0 +1,29 @@
+Tutorial Enrolment
+
+
+ Please select from the dropdown below the tutorial you would like to enrol in.
+
+
+
+ Tutorials
+
+ @for (tutorial of getTutorialsForStream(); track tutorial) {
+ {{ tutorial.abbreviation }}
+ }
+
+
+
+
+
+ Cancel
+
+ Enrol
+
+
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
new file mode 100644
index 0000000000..1e2deb2a2f
--- /dev/null
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
@@ -0,0 +1,52 @@
+import {Component, Inject, LOCALE_ID} from '@angular/core';
+import {MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
+import {
+ TaskComment,
+ TaskCommentService,
+ Task,
+ Unit,
+ Tutorial,
+} from 'src/app/api/models/doubtfire-model';
+import {AppInjector} from 'src/app/app-injector';
+import {FormControl, Validators, FormGroup, FormGroupDirective, NgForm} from '@angular/forms';
+import {ErrorStateMatcher} from '@angular/material/core';
+import {AlertService} from '../../services/alert.service';
+
+export interface TutorialEnrolmentModalData {
+ task: Task;
+}
+
+@Component({
+ selector: 'f-tutorial-enrolment-modal',
+ templateUrl: './tutorial-enrolment-modal.component.html',
+})
+export class TutorialEnrolmentModalComponent {
+ private readonly tutorialStreamAbbreviation = 'wrkshop-2'; // debug: this should be passed from the taskDefinition model
+
+ tutorialsFormControl = new FormControl(null);
+
+ constructor(
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: TutorialEnrolmentModalData,
+ private alerts: AlertService,
+ ) {}
+
+ public getTutorialsForStream() {
+ const student = this.data.task.project;
+ return this.data.task.unit.tutorials.filter((tutorial) => {
+ const result: boolean =
+ student.campus == null ||
+ tutorial.campus == null ||
+ student.campus.id === tutorial.campus.id;
+
+ if (!result) return result;
+ if (tutorial.tutorialStream) {
+ return tutorial.tutorialStream.abbreviation === this.tutorialStreamAbbreviation;
+ }
+ });
+ }
+
+ attemptTutorialEnrolment() {
+ console.log(`Attempting tutorial enrolment: ${this.tutorialsFormControl.value.abbreviation}`);
+ }
+}
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service.ts b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service.ts
new file mode 100644
index 0000000000..01b72f0b31
--- /dev/null
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service.ts
@@ -0,0 +1,24 @@
+import {Injectable} from '@angular/core';
+import {Task} from 'src/app/api/models/task';
+import {MatDialogRef, MatDialog} from '@angular/material/dialog';
+import {
+ TutorialEnrolmentModalComponent,
+ TutorialEnrolmentModalData,
+} from './tutorial-enrolment-modal.component';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class TutorialEnrolmentModalService {
+ constructor(public dialog: MatDialog) {}
+
+ public show(data: TutorialEnrolmentModalData) {
+ let dialogRef: MatDialogRef;
+
+ dialogRef = this.dialog.open(TutorialEnrolmentModalComponent, {data});
+
+ dialogRef.afterOpened().subscribe((result: any) => {});
+
+ dialogRef.afterClosed().subscribe((result: any) => {});
+ }
+}
diff --git a/src/app/doubtfire-angular.module.ts b/src/app/doubtfire-angular.module.ts
index 886e54906a..4d561e1103 100644
--- a/src/app/doubtfire-angular.module.ts
+++ b/src/app/doubtfire-angular.module.ts
@@ -243,6 +243,7 @@ import {ScormExtensionModalComponent} from './common/modals/scorm-extension-moda
import { D2lTransferComponent, D2lTransferModal } from './units/states/portfolios/d2l-transfer-modal/d2l-transfer.component';
import { SuccessCloseComponent } from './common/success-close/success-close.component';
import { TaskDefinitionTutorialEnrolmentComponent } from './units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component';
+import { TutorialEnrolmentModalComponent } from './common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component';
// See https://stackoverflow.com/questions/55721254/how-to-change-mat-datepicker-date-format-to-dd-mm-yyyy-in-simplest-way/58189036#58189036
const MY_DATE_FORMAT = {
@@ -368,6 +369,7 @@ const MY_DATE_FORMAT = {
TaskTutorialEnrolmentCardComponent,
ScormExtensionCommentComponent,
ScormExtensionModalComponent,
+ TutorialEnrolmentModalComponent
],
// Services we provide
providers: [
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index 46a1d5c213..b4640da3bf 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -1,5 +1,6 @@
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
+import {TutorialEnrolmentModalService} from 'src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service';
@Component({
selector: 'f-task-tutorial-enrolment-card',
@@ -12,7 +13,10 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
isSubmitted: boolean; // task submitted and student enrolled in tutorial
tutorialEnrolmentEnabled: boolean;
- constructor(private userService: UserService) {
+ constructor(
+ private userService: UserService,
+ private tutorialEnrolmentModalService: TutorialEnrolmentModalService,
+ ) {
this.user = this.userService.currentUser;
}
@@ -36,5 +40,6 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
launchTutorialEnrolment(): void {
console.log('launching tutorial enrolment...'); // debug
+ this.tutorialEnrolmentModalService.show({task: this.task});
}
}
From c9a8ae9365cb001cabc7ae67176f546060d3c73f Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 17:10:29 +1000
Subject: [PATCH 06/14] feat: check for existing tutorial enrolment
---
...ask-tutorial-enrolment-card.component.html | 39 ++++++++++++-------
.../task-tutorial-enrolment-card.component.ts | 13 +++++++
2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
index a50093fd92..4954655053 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
@@ -1,16 +1,27 @@
-@if (!isSubmitted) {
-
-
- Tutorial Enrolment
-
-
-
- This task lets you choose a tutorial to enrol in for the semester. Your selected tutorial
- will determine which tutor is assigned to mark your work throughout the teaching period.
-
+
+
+ Tutorial Enrolment
+
+
+
+ This task lets you choose a tutorial to enrol in for the semester. Your selected tutorial will
+ determine which tutor is assigned to mark your work throughout the teaching period.
+
+ @if (!isStudentEnrolledInTutorialStream()) {
To complete this task, you must enrol in a tutorial from the provided list.
-
-
+ }
+ @if (isStudentEnrolledInTutorialStream()) {
+ You're enrolled! You can now proceed to the next task.
+
+ You can confirm your enrolment in the
+ Tutorials List .
+
+ }
+
+ @if (!isStudentEnrolledInTutorialStream()) {
+
launch
@@ -18,5 +29,5 @@
Begin enrolment
-
-}
+ }
+
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index b4640da3bf..0b39720c29 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -34,6 +34,19 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
}
}
+ private readonly tutorialStreamAbbreviation = 'wrkshop-2'; // debug: this should be passed from the taskDefinition model
+ isStudentEnrolledInTutorialStream(): boolean {
+ let isEnrolledInTutorialStream = false;
+
+ const studentTutorialEnrolments = this.task.project.tutorials;
+ for (const tutorial of studentTutorialEnrolments) {
+ if (tutorial.tutorialStream.abbreviation === this.tutorialStreamAbbreviation) {
+ isEnrolledInTutorialStream = true;
+ }
+ }
+ return isEnrolledInTutorialStream;
+ }
+
isNotStudent(): boolean {
return this.user !== this.task.project.student;
}
From 90693f1d39d05eef185198cdea21bf15d9e1fec9 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 17:19:10 +1000
Subject: [PATCH 07/14] fix: typo
---
.../task-tutorial-enrolment-card.component.html | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
index 4954655053..a588cd88bc 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
@@ -4,8 +4,9 @@
- This task lets you choose a tutorial to enrol in for the semester. Your selected tutorial will
- determine which tutor is assigned to mark your work throughout the teaching period.
+ This task lets you choose a tutorial to enrol in for the teaching period. Your selected
+ tutorial will determine which tutor is assigned to mark your work throughout the teaching
+ period.
@if (!isStudentEnrolledInTutorialStream()) {
To complete this task, you must enrol in a tutorial from the provided list.
From 344fac2758f9696117152b58352d4de4e32d9c4d Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 17:23:42 +1000
Subject: [PATCH 08/14] feat: enrol student into tutorial
---
.../tutorial-enrolment-modal.component.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
index 1e2deb2a2f..421facdb10 100644
--- a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
@@ -47,6 +47,7 @@ export class TutorialEnrolmentModalComponent {
}
attemptTutorialEnrolment() {
- console.log(`Attempting tutorial enrolment: ${this.tutorialsFormControl.value.abbreviation}`);
+ const selectedTutorial = this.tutorialsFormControl.value;
+ this.data.task.project.switchToTutorial(selectedTutorial);
}
}
From 9a0feef0364985491f7c5c801c8c1a3e35ce6774 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 16 Apr 2025 17:28:12 +1000
Subject: [PATCH 09/14] feat: disable enrolment button if no tutorial selected
---
.../tutorial-enrolment-modal.component.html | 1 +
.../task-tutorial-enrolment-card.component.ts | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
index 2bc2a8054b..500ddff2d2 100644
--- a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.html
@@ -21,6 +21,7 @@ Tutorial Enrolment
style="margin-right: 10px; float: right"
mat-stroked-button
color="primary"
+ [disabled]="!tutorialsFormControl.value"
mat-button
(click)="attemptTutorialEnrolment()"
>
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index 0b39720c29..f5f5ff1210 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -52,7 +52,6 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
}
launchTutorialEnrolment(): void {
- console.log('launching tutorial enrolment...'); // debug
this.tutorialEnrolmentModalService.show({task: this.task});
}
}
From 15ba574c6b7f802a5a963ee6e09a277ab5c9cbd6 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 7 May 2025 16:12:26 +1000
Subject: [PATCH 10/14] feat: add new schema properties
---
src/app/api/models/task-definition.ts | 1 +
.../api/services/task-definition.service.ts | 29 ++++++++++++-------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/app/api/models/task-definition.ts b/src/app/api/models/task-definition.ts
index f242f6837e..8c34133b5c 100644
--- a/src/app/api/models/task-definition.ts
+++ b/src/app/api/models/task-definition.ts
@@ -38,6 +38,7 @@ export class TaskDefinition extends Entity {
scormTimeDelayEnabled: boolean;
scormAttemptLimit: number = 0;
tutorialSelfEnrolmentEnabled: boolean;
+ tutorialSelfEnrolmentStream: TutorialStream = null;
hasTaskAssessmentResources: boolean;
isGraded: boolean;
maxQualityPts: number;
diff --git a/src/app/api/services/task-definition.service.ts b/src/app/api/services/task-definition.service.ts
index 0914929fbe..f1b24deb29 100644
--- a/src/app/api/services/task-definition.service.ts
+++ b/src/app/api/services/task-definition.service.ts
@@ -1,11 +1,11 @@
-import { CachedEntityService } from 'ngx-entity-service';
-import { TaskDefinition, Unit } from 'src/app/api/models/doubtfire-model';
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
+import {CachedEntityService} from 'ngx-entity-service';
+import {TaskDefinition, Unit} from 'src/app/api/models/doubtfire-model';
+import {Injectable} from '@angular/core';
+import {HttpClient} from '@angular/common/http';
import API_URL from 'src/app/config/constants/apiURL';
-import { MappingFunctions } from './mapping-fn';
-import { AppInjector } from 'src/app/app-injector';
-import { Observable } from 'rxjs';
+import {MappingFunctions} from './mapping-fn';
+import {AppInjector} from 'src/app/app-injector';
+import {Observable} from 'rxjs';
@Injectable()
export class TaskDefinitionService extends CachedEntityService {
@@ -100,6 +100,7 @@ export class TaskDefinitionService extends CachedEntityService {
'hasTaskResources',
'hasTaskAssessmentResources',
'scormEnabled',
+ 'tutorialSelfEnrolmentEnabled',
'hasScormData',
'scormAllowReview',
'scormBypassTest',
@@ -108,7 +109,7 @@ export class TaskDefinitionService extends CachedEntityService {
'isGraded',
'maxQualityPts',
'overseerImageId',
- 'assessmentEnabled'
+ 'assessmentEnabled',
);
this.mapping.mapAllKeysToJsonExcept(
@@ -116,7 +117,7 @@ export class TaskDefinitionService extends CachedEntityService {
'hasTaskSheet',
'hasTaskResources',
'hasTaskAssessmentResources',
- 'hasScormData'
+ 'hasScormData',
);
}
@@ -133,13 +134,19 @@ export class TaskDefinitionService extends CachedEntityService {
public uploadTaskResources(taskDefinition: TaskDefinition, file: File): Observable {
const formData = new FormData();
formData.append('file', file);
- return AppInjector.get(HttpClient).post(taskDefinition.taskResourcesUploadUrl, formData);
+ return AppInjector.get(HttpClient).post(
+ taskDefinition.taskResourcesUploadUrl,
+ formData,
+ );
}
public uploadOverseerResources(taskDefinition: TaskDefinition, file: File): Observable {
const formData = new FormData();
formData.append('file', file);
- return AppInjector.get(HttpClient).post(taskDefinition.taskAssessmentResourcesUploadUrl, formData);
+ return AppInjector.get(HttpClient).post(
+ taskDefinition.taskAssessmentResourcesUploadUrl,
+ formData,
+ );
}
public uploadScormData(taskDefinition: TaskDefinition, file: File): Observable {
From 83d5c0706661e1546c1afc6abc0c12a2d2abc001 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 14 May 2025 16:32:40 +1000
Subject: [PATCH 11/14] refactor: map stream abbreviation to tutorial stream
object
---
src/app/api/models/task-definition.ts | 39 ++++++++++++-------
.../api/services/task-definition.service.ts | 9 +++++
...finition-tutorial-enrolment.component.html | 4 +-
...definition-tutorial-enrolment.component.ts | 13 ++++++-
4 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/src/app/api/models/task-definition.ts b/src/app/api/models/task-definition.ts
index 62e1deb6f8..388e06e8a6 100644
--- a/src/app/api/models/task-definition.ts
+++ b/src/app/api/models/task-definition.ts
@@ -1,14 +1,20 @@
-import { HttpClient } from '@angular/common/http';
-import { Entity, EntityMapping } from 'ngx-entity-service';
-import { Observable, tap } from 'rxjs';
-import { AppInjector } from 'src/app/app-injector';
-import { DoubtfireConstants } from 'src/app/config/constants/doubtfire-constants';
-import { Grade, GroupSet, TutorialStream, Unit } from './doubtfire-model';
-import { TaskDefinitionService } from '../services/task-definition.service';
-
-export type UploadRequirement = { key: string; name: string; type: string; tiiCheck?: boolean; tiiPct?: number };
+import {HttpClient} from '@angular/common/http';
+import {Entity, EntityMapping} from 'ngx-entity-service';
+import {Observable, tap} from 'rxjs';
+import {AppInjector} from 'src/app/app-injector';
+import {DoubtfireConstants} from 'src/app/config/constants/doubtfire-constants';
+import {Grade, GroupSet, TutorialStream, Unit} from './doubtfire-model';
+import {TaskDefinitionService} from '../services/task-definition.service';
+
+export type UploadRequirement = {
+ key: string;
+ name: string;
+ type: string;
+ tiiCheck?: boolean;
+ tiiPct?: number;
+};
-export type SimilarityCheck = { key: string; type: string; pattern: string };
+export type SimilarityCheck = {key: string; type: string; pattern: string};
export class TaskDefinition extends Entity {
id: number;
@@ -75,7 +81,7 @@ export class TaskDefinition extends Entity {
entity: this,
cache: this.unit.taskDefinitionCache,
constructorParams: this.unit,
- }
+ },
);
} else {
return svc.update(
@@ -83,7 +89,7 @@ export class TaskDefinition extends Entity {
unitId: this.unit.id,
id: this.id,
},
- { entity: this }
+ {entity: this},
);
}
}
@@ -130,7 +136,10 @@ export class TaskDefinition extends Entity {
}
public matches(text: string): boolean {
- return this.abbreviation.toLowerCase().indexOf(text) !== -1 || this.name.toLowerCase().indexOf(text) !== -1;
+ return (
+ this.abbreviation.toLowerCase().indexOf(text) !== -1 ||
+ this.name.toLowerCase().indexOf(text) !== -1
+ );
}
/**
@@ -223,7 +232,9 @@ export class TaskDefinition extends Entity {
public deleteTaskResources(): Observable {
const httpClient = AppInjector.get(HttpClient);
- return httpClient.delete(this.taskResourcesUploadUrl).pipe(tap(() => (this.hasTaskResources = false)));
+ return httpClient
+ .delete(this.taskResourcesUploadUrl)
+ .pipe(tap(() => (this.hasTaskResources = false)));
}
public deleteScormData(): Observable {
diff --git a/src/app/api/services/task-definition.service.ts b/src/app/api/services/task-definition.service.ts
index 70e88c6a0c..db1a2afbc4 100644
--- a/src/app/api/services/task-definition.service.ts
+++ b/src/app/api/services/task-definition.service.ts
@@ -81,6 +81,15 @@ export class TaskDefinitionService extends CachedEntityService {
return taskDef.tutorialStream?.abbreviation;
},
},
+ {
+ keys: ['tutorialSelfEnrolmentStream', 'tutorial_self_enrolment_stream_abbr'],
+ toEntityFn: (data: object, key: string, taskDef: TaskDefinition, params?: any) => {
+ return taskDef.unit.tutorialStreamsCache.get(data[key]);
+ },
+ toJsonFn: (taskDef: TaskDefinition, key: string) => {
+ return taskDef.tutorialSelfEnrolmentStream?.abbreviation;
+ },
+ },
'plagiarismWarnPct',
'restrictStatusUpdates',
{
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
index 352cf4021c..b1180917dd 100644
--- a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
+++ b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.html
@@ -9,9 +9,9 @@
Tutorial Streams - Which stream students can enrol into a tutorial from?
-
+
@for (stream of unit.tutorialStreams; track stream) {
- {{ stream.name }} — ({{
stream.tutorialsIn(taskDefinition.unit).length
}}
diff --git a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
index 4cd5e61ab7..1f4675d0f8 100644
--- a/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
+++ b/src/app/units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-tutorial-enrolment/task-definition-tutorial-enrolment.component.ts
@@ -18,7 +18,7 @@ export class TaskDefinitionTutorialEnrolmentComponent implements OnInit {
public _selectedTutorialStreams: TutorialStream[] = [];
- tutoralStreamControl = new FormControl(null, Validators.required);
+ tutoralStreamControl = new FormControl(null, Validators.required);
public ngOnInit(): void {
const tutorialStreams = this.taskDefinition.unit.tutorialStreamsCache.currentValues;
@@ -27,6 +27,17 @@ export class TaskDefinitionTutorialEnrolmentComponent implements OnInit {
console.log(stream);
this._tutorialStreams.push(stream);
}
+
+ console.log(this.taskDefinition.tutorialSelfEnrolmentStream);
+ this.tutoralStreamControl.setValue(this.taskDefinition.tutorialSelfEnrolmentStream);
+ }
+
+ public onSelectStream(): void {
+ const selectedStream = this.tutoralStreamControl.value;
+ if (selectedStream) {
+ console.log(selectedStream);
+ this.taskDefinition.tutorialSelfEnrolmentStream = selectedStream;
+ }
}
constructor(
From 95815d03028677b08933d2e6aaefb2c5b00af6ad Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 14 May 2025 16:39:59 +1000
Subject: [PATCH 12/14] chore: replace debug stream with live data
---
.../tutorial-enrolment-modal.component.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
index 421facdb10..d001aa2408 100644
--- a/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
+++ b/src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.component.ts
@@ -21,8 +21,6 @@ export interface TutorialEnrolmentModalData {
templateUrl: './tutorial-enrolment-modal.component.html',
})
export class TutorialEnrolmentModalComponent {
- private readonly tutorialStreamAbbreviation = 'wrkshop-2'; // debug: this should be passed from the taskDefinition model
-
tutorialsFormControl = new FormControl(null);
constructor(
@@ -32,8 +30,12 @@ export class TutorialEnrolmentModalComponent {
) {}
public getTutorialsForStream() {
+ const tutorialStreamAbbreviation =
+ this.data.task.definition.tutorialSelfEnrolmentStream.abbreviation;
+
const student = this.data.task.project;
return this.data.task.unit.tutorials.filter((tutorial) => {
+ // Filter workshops based on campus allocation
const result: boolean =
student.campus == null ||
tutorial.campus == null ||
@@ -41,7 +43,7 @@ export class TutorialEnrolmentModalComponent {
if (!result) return result;
if (tutorial.tutorialStream) {
- return tutorial.tutorialStream.abbreviation === this.tutorialStreamAbbreviation;
+ return tutorial.tutorialStream.abbreviation === tutorialStreamAbbreviation;
}
});
}
From 4a92dc048957ee66f8028cf4e257b68713e7db84 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 14 May 2025 16:50:32 +1000
Subject: [PATCH 13/14] fix: remove debug
---
...ask-tutorial-enrolment-card.component.html | 2 +-
.../task-tutorial-enrolment-card.component.ts | 24 ++++---------------
2 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
index a588cd88bc..081f2bc0b4 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.html
@@ -1,4 +1,4 @@
-
+
Tutorial Enrolment
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index f5f5ff1210..5ceb0bb0ff 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -1,4 +1,4 @@
-import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
+import {Component, Input} from '@angular/core';
import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
import {TutorialEnrolmentModalService} from 'src/app/common/modals/tutorial-enrolment-modal/tutorial-enrolment-modal.service';
@@ -7,11 +7,10 @@ import {TutorialEnrolmentModalService} from 'src/app/common/modals/tutorial-enro
templateUrl: './task-tutorial-enrolment-card.component.html',
styleUrls: ['./task-tutorial-enrolment-card.component.scss'],
})
-export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
+export class TaskTutorialEnrolmentCardComponent {
@Input() task: Task;
user: User;
isSubmitted: boolean; // task submitted and student enrolled in tutorial
- tutorialEnrolmentEnabled: boolean;
constructor(
private userService: UserService,
@@ -20,27 +19,14 @@ export class TaskTutorialEnrolmentCardComponent implements OnChanges, OnInit {
this.user = this.userService.currentUser;
}
- ngOnInit(): void {
- this.tutorialEnrolmentEnabled = true; // debug
- }
-
- ngOnChanges(changes: SimpleChanges) {
- if (
- changes.task &&
- changes.task.currentValue &&
- changes.task.currentValue.definition.tutorialSelfEnrolmentEnabled
- ) {
- console.log('self enrolment feature is enabled for this task'); // debug
- }
- }
-
- private readonly tutorialStreamAbbreviation = 'wrkshop-2'; // debug: this should be passed from the taskDefinition model
isStudentEnrolledInTutorialStream(): boolean {
+ const tutorialStreamAbbreviation =
+ this.task.definition.tutorialSelfEnrolmentStream.abbreviation;
let isEnrolledInTutorialStream = false;
const studentTutorialEnrolments = this.task.project.tutorials;
for (const tutorial of studentTutorialEnrolments) {
- if (tutorial.tutorialStream.abbreviation === this.tutorialStreamAbbreviation) {
+ if (tutorial.tutorialStream.abbreviation === tutorialStreamAbbreviation) {
isEnrolledInTutorialStream = true;
}
}
From dcef99868bd0fd41bf408e432a33402fac083418 Mon Sep 17 00:00:00 2001
From: b0ink <40929320+b0ink@users.noreply.github.com>
Date: Wed, 14 May 2025 16:51:19 +1000
Subject: [PATCH 14/14] fix: remove unused var
---
.../task-tutorial-enrolment-card.component.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
index 5ceb0bb0ff..28fc291938 100644
--- a/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
+++ b/src/app/projects/states/dashboard/directives/task-dashboard/directives/task-tutorial-enrolment-card/task-tutorial-enrolment-card.component.ts
@@ -10,7 +10,6 @@ import {TutorialEnrolmentModalService} from 'src/app/common/modals/tutorial-enro
export class TaskTutorialEnrolmentCardComponent {
@Input() task: Task;
user: User;
- isSubmitted: boolean; // task submitted and student enrolled in tutorial
constructor(
private userService: UserService,