From 870f648fbd0b7d61598fe57b15b4a66647a918fe Mon Sep 17 00:00:00 2001 From: "SD." Date: Mon, 14 Oct 2024 13:36:00 +1100 Subject: [PATCH 1/5] Add copy button without practical function --- .../instructor-course-enroll-page.component.html | 10 ++++++++++ .../instructor-course-enroll-page.component.ts | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.html b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.html index c73db728e8f..aef2706a2f3 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.html +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.html @@ -108,6 +108,16 @@

Enroll Students for {{ courseId }}

Enroll students + +
diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts index a7344b7a82a..b13d1357953 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts @@ -656,4 +656,11 @@ export class InstructorCourseEnrollPageComponent implements OnInit { scrollOffset: 70, }); } + + /** + * Implement the copy method + */ + copyToClipboard() { + alert("Copy the student information") + } } From 4d2d3c96ecb23aac3f5412e427a15d4848b2de95 Mon Sep 17 00:00:00 2001 From: simon liu Date: Thu, 17 Oct 2024 15:29:19 +1100 Subject: [PATCH 2/5] Implemented copyToClipboard function. --- .../instructor-course-enroll-page.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts index b13d1357953..84892cbba3d 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts @@ -660,7 +660,12 @@ export class InstructorCourseEnrollPageComponent implements OnInit { /** * Implement the copy method */ - copyToClipboard() { - alert("Copy the student information") + copyToClipboard(): void { + const existingStudentsHOTInstance: Handsontable = this.hotRegisterer.getInstance(this.existingStudentsHOT); + const newStudentsHOTInstance: Handsontable = this.hotRegisterer.getInstance(this.newStudentsHOT); + + const existingStudentsData = existingStudentsHOTInstance.getData(); + + newStudentsHOTInstance.loadData(existingStudentsData); } } From feadf321d20504f5457c33ab4d93e36506d64593 Mon Sep 17 00:00:00 2001 From: "SD." Date: Fri, 18 Oct 2024 09:23:43 +1100 Subject: [PATCH 3/5] Add empty judgment and operation prompts --- ...instructor-course-enroll-page.component.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts index 84892cbba3d..aef4e4e4dce 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts @@ -666,6 +666,30 @@ export class InstructorCourseEnrollPageComponent implements OnInit { const existingStudentsData = existingStudentsHOTInstance.getData(); + + const validStudents: StudentEnrollRequest[] = existingStudentsData + .filter((row: string[]) => !row.every(cell => cell === null || cell === '')) + .map((row: string[]) => ({ + section: row[0] ? row[0].trim() : '', + team: row[1] ? row[1].trim() : '', + name: row[2] ? row[2].trim() : '', + email: row[3] ? row[3].trim() : '', + comments: row[4] ? row[4].trim() : '', + })); + newStudentsHOTInstance.loadData(existingStudentsData); + + // judge if the existing student is empty + if (validStudents.length === 0) { + this.statusMessageService.showErrorToast('No valid existing students to copy.'); + return; + } + + if(this.isExistingStudentsPanelCollapsed) { + this.statusMessageService.showWarningToast('Please expand existing students.'); + } else { + this.statusMessageService.showSuccessToast('Existing students copied successfully.'); + } + } } From a25ceef2833a19e7bb2c01a35f036657a4d7db30 Mon Sep 17 00:00:00 2001 From: "SD." Date: Sat, 19 Oct 2024 22:28:09 +1100 Subject: [PATCH 4/5] Optimize the implement logic of the copy function prompt --- .../instructor-course-enroll-page.component.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts index aef4e4e4dce..48a5ebe434a 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts @@ -666,27 +666,17 @@ export class InstructorCourseEnrollPageComponent implements OnInit { const existingStudentsData = existingStudentsHOTInstance.getData(); - - const validStudents: StudentEnrollRequest[] = existingStudentsData - .filter((row: string[]) => !row.every(cell => cell === null || cell === '')) - .map((row: string[]) => ({ - section: row[0] ? row[0].trim() : '', - team: row[1] ? row[1].trim() : '', - name: row[2] ? row[2].trim() : '', - email: row[3] ? row[3].trim() : '', - comments: row[4] ? row[4].trim() : '', - })); - newStudentsHOTInstance.loadData(existingStudentsData); // judge if the existing student is empty - if (validStudents.length === 0) { + if(!this.isExistingStudentsPresent) { this.statusMessageService.showErrorToast('No valid existing students to copy.'); return; } if(this.isExistingStudentsPanelCollapsed) { this.statusMessageService.showWarningToast('Please expand existing students.'); + return; } else { this.statusMessageService.showSuccessToast('Existing students copied successfully.'); } From c7b26e326a610cd615e42f9dd84886253eed868e Mon Sep 17 00:00:00 2001 From: "SD." Date: Sun, 20 Oct 2024 15:08:49 +1100 Subject: [PATCH 5/5] Delete redundant comments --- .../instructor-course-enroll-page.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts index 48a5ebe434a..3e570ef54b2 100644 --- a/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-enroll-page/instructor-course-enroll-page.component.ts @@ -668,7 +668,6 @@ export class InstructorCourseEnrollPageComponent implements OnInit { newStudentsHOTInstance.loadData(existingStudentsData); - // judge if the existing student is empty if(!this.isExistingStudentsPresent) { this.statusMessageService.showErrorToast('No valid existing students to copy.'); return;