diff --git a/src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java b/src/client/java/teammates/client/scripts/DataMigrationToRemoveIsArchivedField.java similarity index 65% rename from src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java rename to src/client/java/teammates/client/scripts/DataMigrationToRemoveIsArchivedField.java index 877a0ed4e41..da31a1b6a63 100644 --- a/src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java +++ b/src/client/java/teammates/client/scripts/DataMigrationToRemoveIsArchivedField.java @@ -7,12 +7,12 @@ import teammates.storage.entity.Instructor; /** - * Script to change all null value to false in the isArchived field for Instructor entity. + * Script to remove the isArchived field for Instructor entity. */ -public class DataMigrationForInstructorNullIsArchivedField extends DataMigrationEntitiesBaseScript { +public class DataMigrationToRemoveIsArchivedField extends DataMigrationEntitiesBaseScript { public static void main(String[] args) { - new DataMigrationForInstructorNullIsArchivedField().doOperationRemotely(); + new DataMigrationToRemoveIsArchivedField().doOperationRemotely(); } @Override @@ -30,17 +30,14 @@ protected boolean isMigrationNeeded(Instructor instructor) { try { Field isArchivedField = instructor.getClass().getDeclaredField("isArchived"); isArchivedField.setAccessible(true); - return isArchivedField.get(instructor) == null; + return isArchivedField.get(instructor) != null; } catch (ReflectiveOperationException e) { - return true; + return false; } } @Override protected void migrateEntity(Instructor instructor) { - instructor.setIsArchived(instructor.getIsArchived()); - saveEntityDeferred(instructor); } - } diff --git a/src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java b/src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java index fe3f6ce2283..ae43ceb694f 100644 --- a/src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java +++ b/src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java @@ -249,10 +249,6 @@ protected CourseAttributes getCourse(CourseAttributes course) { return getCourse(course.getId()); } - CourseAttributes getArchivedCourse(String instructorId, String courseId) { - return BACKDOOR.getArchivedCourse(instructorId, courseId); - } - FeedbackQuestionAttributes getFeedbackQuestion(String courseId, String feedbackSessionName, int qnNumber) { return BACKDOOR.getFeedbackQuestion(courseId, feedbackSessionName, qnNumber); } diff --git a/src/e2e/java/teammates/e2e/cases/InstructorCoursesPageE2ETest.java b/src/e2e/java/teammates/e2e/cases/InstructorCoursesPageE2ETest.java index 14cd2839155..b0124abb5b7 100644 --- a/src/e2e/java/teammates/e2e/cases/InstructorCoursesPageE2ETest.java +++ b/src/e2e/java/teammates/e2e/cases/InstructorCoursesPageE2ETest.java @@ -15,7 +15,6 @@ import teammates.common.util.AppUrl; import teammates.common.util.Const; import teammates.e2e.pageobjects.InstructorCoursesPage; -import teammates.test.ThreadHelper; /** * SUT: {@link Const.WebPageURIs#INSTRUCTOR_COURSES_PAGE}. @@ -79,12 +78,10 @@ public void testAll() { InstructorCoursesPage coursesPage = loginToPage(url, InstructorCoursesPage.class, instructorId); ______TS("verify loaded data"); - CourseAttributes[] activeCourses = { courses[0], courses[3] }; - CourseAttributes[] archivedCourses = { courses[1] }; + CourseAttributes[] activeCourses = { courses[1], courses[0], courses[3] }; CourseAttributes[] deletedCourses = { courses[2] }; coursesPage.verifyActiveCoursesDetails(activeCourses); - coursesPage.verifyArchivedCoursesDetails(archivedCourses); coursesPage.verifyDeletedCoursesDetails(deletedCourses); ______TS("verify statistics"); @@ -94,7 +91,7 @@ public void testAll() { coursesPage.verifyNotModifiable(courses[0].getId()); ______TS("add new course"); - CourseAttributes[] activeCoursesWithNewCourse = { courses[0], courses[3], newCourse }; + CourseAttributes[] activeCoursesWithNewCourse = { courses[0], courses[3], courses[1], newCourse }; coursesPage.addCourse(newCourse); coursesPage.verifyStatusMessage("The course has been added."); @@ -103,7 +100,7 @@ public void testAll() { verifyPresentInDatabase(newCourse); ______TS("copy course"); - CourseAttributes[] activeCoursesWithCopyCourse = { courses[0], courses[3], newCourse, copyCourse }; + CourseAttributes[] activeCoursesWithCopyCourse = { courses[0], courses[3], courses[1], newCourse, copyCourse }; coursesPage.copyCourse(courses[3].getId(), copyCourse); coursesPage.verifyStatusMessage("The course has been added."); @@ -112,26 +109,6 @@ public void testAll() { verifyPresentInDatabase(copyCourse); verifyPresentInDatabase(copySession); - ______TS("archive course"); - CourseAttributes[] archivedCoursesWithNewCourse = { newCourse, courses[1] }; - coursesPage.archiveCourse(newCourse.getId()); - - coursesPage.verifyStatusMessage("The course " + newCourse.getId() + " has been archived. " - + "It will not appear on the home page anymore."); - coursesPage.verifyNumActiveCourses(3); - coursesPage.verifyArchivedCoursesDetails(archivedCoursesWithNewCourse); - verifyCourseArchivedInDatabase(instructorId, newCourse); - - ______TS("unarchive course"); - CourseAttributes[] activeCoursesWithNewCourseSortedByName = { copyCourse, courses[3], newCourse, courses[0] }; - coursesPage.unarchiveCourse(newCourse.getId()); - - coursesPage.verifyStatusMessage("The course has been unarchived."); - coursesPage.verifyNumArchivedCourses(1); - coursesPage.sortByCourseName(); - coursesPage.verifyActiveCoursesDetails(activeCoursesWithNewCourseSortedByName); - verifyCourseNotArchivedInDatabase(instructorId, newCourse); - ______TS("move active course to recycle bin"); newCourse.setDeletedAt(Instant.now()); CourseAttributes[] deletedCoursesWithNewCourse = { newCourse, courses[2] }; @@ -139,14 +116,14 @@ public void testAll() { coursesPage.verifyStatusMessage("The course " + newCourse.getId() + " has been deleted. " + "You can restore it from the Recycle Bin manually."); - coursesPage.verifyNumActiveCourses(3); + coursesPage.verifyNumActiveCourses(4); coursesPage.verifyDeletedCoursesDetails(deletedCoursesWithNewCourse); assertTrue(BACKDOOR.isCourseInRecycleBin(newCourse.getId())); ______TS("restore active course"); newCourse.setDeletedAt(null); CourseAttributes[] activeCoursesWithNewCourseSortedByCreationDate = - { copyCourse, newCourse, courses[0], courses[3] }; + { copyCourse, newCourse, courses[1], courses[0], courses[3] }; coursesPage.restoreCourse(newCourse.getId()); coursesPage.verifyStatusMessage("The course " + newCourse.getId() + " has been restored."); @@ -156,30 +133,8 @@ public void testAll() { coursesPage.verifyActiveCoursesDetails(activeCoursesWithNewCourseSortedByCreationDate); assertFalse(BACKDOOR.isCourseInRecycleBin(newCourse.getId())); - ______TS("move archived course to recycle bin"); - coursesPage.archiveCourse(newCourse.getId()); - newCourse.setDeletedAt(Instant.now()); - coursesPage.moveArchivedCourseToRecycleBin(newCourse.getId()); - - coursesPage.verifyStatusMessage("The course " + newCourse.getId() + " has been deleted. " - + "You can restore it from the Recycle Bin manually."); - coursesPage.verifyNumArchivedCourses(1); - coursesPage.verifyDeletedCoursesDetails(deletedCoursesWithNewCourse); - assertTrue(BACKDOOR.isCourseInRecycleBin(newCourse.getId())); - - ______TS("restore archived course"); - newCourse.setDeletedAt(null); - coursesPage.restoreCourse(newCourse.getId()); - - coursesPage.verifyStatusMessage("The course " + newCourse.getId() + " has been restored."); - coursesPage.waitForPageToLoad(); - coursesPage.verifyNumDeletedCourses(1); - coursesPage.verifyArchivedCoursesDetails(archivedCoursesWithNewCourse); - assertFalse(BACKDOOR.isCourseInRecycleBin(newCourse.getId())); - verifyCourseArchivedInDatabase(instructorId, newCourse); - ______TS("permanently delete course"); - coursesPage.moveArchivedCourseToRecycleBin(newCourse.getId()); + coursesPage.moveCourseToRecycleBin(newCourse.getId()); coursesPage.deleteCourse(newCourse.getId()); coursesPage.verifyStatusMessage("The course " + newCourse.getId() @@ -187,30 +142,12 @@ public void testAll() { coursesPage.verifyNumDeletedCourses(1); verifyAbsentInDatabase(newCourse); - ______TS("restore all"); - coursesPage.moveArchivedCourseToRecycleBin(courses[1].getId()); - CourseAttributes[] activeCoursesWithRestored = { courses[0], courses[3], courses[2], copyCourse }; - coursesPage.restoreAllCourses(); - - coursesPage.verifyStatusMessage("All courses have been restored."); - coursesPage.waitForPageToLoad(); - coursesPage.sortByCourseId(); - coursesPage.verifyActiveCoursesDetails(activeCoursesWithRestored); - coursesPage.verifyArchivedCoursesDetails(archivedCourses); - coursesPage.verifyNumDeletedCourses(0); - assertFalse(BACKDOOR.isCourseInRecycleBin(courses[1].getId())); - assertFalse(BACKDOOR.isCourseInRecycleBin(courses[2].getId())); - ______TS("permanently delete all"); - coursesPage.moveArchivedCourseToRecycleBin(courses[1].getId()); - coursesPage.moveCourseToRecycleBin(courses[2].getId()); coursesPage.deleteAllCourses(); coursesPage.verifyStatusMessage("All courses have been permanently deleted."); - coursesPage.verifyNumActiveCourses(3); - coursesPage.verifyNumArchivedCourses(0); + coursesPage.verifyNumActiveCourses(4); coursesPage.verifyNumDeletedCourses(0); - verifyAbsentInDatabase(courses[1]); verifyAbsentInDatabase(courses[2]); } @@ -242,26 +179,4 @@ private void verifyActiveCourseStatistics(InstructorCoursesPage coursesPage, Cou coursesPage.verifyActiveCourseStatistics(course, Integer.toString(numSections), Integer.toString(numTeams), Integer.toString(numStudents), Integer.toString(numUnregistered)); } - - private void verifyCourseArchivedInDatabase(String instructorId, CourseAttributes course) { - int retryLimit = 5; - CourseAttributes actual = getArchivedCourse(instructorId, course.getId()); - while (actual == null && retryLimit > 0) { - retryLimit--; - ThreadHelper.waitFor(1000); - actual = getArchivedCourse(instructorId, course.getId()); - } - assertEquals(actual, course); - } - - private void verifyCourseNotArchivedInDatabase(String instructorId, CourseAttributes course) { - int retryLimit = 5; - CourseAttributes actual = getArchivedCourse(instructorId, course.getId()); - while (actual != null && retryLimit > 0) { - retryLimit--; - ThreadHelper.waitFor(1000); - actual = getArchivedCourse(instructorId, course.getId()); - } - assertNull(actual); - } } diff --git a/src/e2e/java/teammates/e2e/cases/InstructorHomePageE2ETest.java b/src/e2e/java/teammates/e2e/cases/InstructorHomePageE2ETest.java index e8967441a48..37aa93f78e3 100644 --- a/src/e2e/java/teammates/e2e/cases/InstructorHomePageE2ETest.java +++ b/src/e2e/java/teammates/e2e/cases/InstructorHomePageE2ETest.java @@ -176,27 +176,18 @@ public void testAll() { homePage.verifyStatusMessage("The feedback session has been deleted. " + "You can restore it from the 'Sessions' tab."); homePage.sortCoursesByCreationDate(); - courseIndex = 1; otherCourseIndex = 0; homePage.verifyCourseTabDetails(otherCourseIndex, otherCourse, otherCourseSessions); assertNotNull(getSoftDeletedSession(copiedSession.getFeedbackSessionName(), instructor.getGoogleId())); - ______TS("archive course"); - homePage.archiveCourse(courseIndex); - - homePage.verifyStatusMessage("The course " + course.getId() + " has been archived. " - + "You can retrieve it from the Courses page."); - homePage.verifyNumCourses(1); - verifyCourseArchivedInDatabase(instructor.getGoogleId(), course); - ______TS("delete course"); otherCourseIndex = 0; homePage.deleteCourse(otherCourseIndex); homePage.verifyStatusMessage("The course " + otherCourse.getId() + " has been deleted. " + "You can restore it from the Recycle Bin manually."); - homePage.verifyNumCourses(0); + homePage.verifyNumCourses(1); assertTrue(BACKDOOR.isCourseInRecycleBin(otherCourse.getId())); } @@ -237,15 +228,4 @@ private void verifySessionPublishedState(FeedbackSessionAttributes feedbackSessi } assertEquals(actual.isPublished(), state); } - - private void verifyCourseArchivedInDatabase(String instructorId, CourseAttributes course) { - int retryLimit = 5; - CourseAttributes actual = getArchivedCourse(instructorId, course.getId()); - while (actual == null && retryLimit > 0) { - retryLimit--; - ThreadHelper.waitFor(1000); - actual = getArchivedCourse(instructorId, course.getId()); - } - assertEquals(actual, course); - } } diff --git a/src/e2e/java/teammates/e2e/pageobjects/InstructorCoursesPage.java b/src/e2e/java/teammates/e2e/pageobjects/InstructorCoursesPage.java index 5708e286b3a..bef42366c25 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/InstructorCoursesPage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/InstructorCoursesPage.java @@ -64,10 +64,6 @@ private WebElement getActiveCoursesTable() { return browser.driver.findElement(By.id("active-courses-table")); } - private WebElement getArchivedCoursesTable() { - return browser.driver.findElement(By.id("archived-courses-table")); - } - private WebElement getDeletedCoursesTable() { return browser.driver.findElement(By.id("deleted-courses-table")); } @@ -87,16 +83,6 @@ public void verifyActiveCourseStatistics(CourseAttributes course, String numSect verifyTableRowValues(getActiveTableRow(course.getId()), courseDetail); } - public void verifyArchivedCoursesDetails(CourseAttributes[] courses) { - showArchiveTable(); - this.waitUntilAnimationFinish(); - String[][] courseDetails = getCourseDetails(courses); - for (int i = 0; i < courses.length; i++) { - // use verifyTableRowValues as archive courses are not sorted - verifyTableRowValues(getArchivedTableRow(courses[i].getId()), courseDetails[i]); - } - } - public void verifyDeletedCoursesDetails(CourseAttributes[] courses) { showDeleteTable(); this.waitUntilAnimationFinish(); @@ -124,10 +110,6 @@ public void verifyNumActiveCourses(int expectedNum) { assertEquals(expectedNum, getCourseCount()); } - public void verifyNumArchivedCourses(int expectedNum) { - assertEquals(expectedNum, getArchivedCourseCount()); - } - public void verifyNumDeletedCourses(int expectedNum) { assertEquals(expectedNum, getDeletedCourseCount()); } @@ -152,14 +134,6 @@ public void showStatistics(String courseId) { } } - public void archiveCourse(String courseId) { - WebElement otherActionButton = getOtherActionsButton(courseId); - click(otherActionButton); - click(getArchiveButton(courseId)); - - waitUntilAnimationFinish(); - } - public void copyCourse(String courseId, CourseAttributes newCourse) { WebElement otherActionButton = getOtherActionsButton(courseId); click(otherActionButton); @@ -182,32 +156,12 @@ public void moveCourseToRecycleBin(String courseId) { waitUntilAnimationFinish(); } - public void unarchiveCourse(String courseId) { - WebElement unarchiveButton = getUnarchiveButton(courseId); - click(unarchiveButton); - - waitUntilAnimationFinish(); - } - - public void moveArchivedCourseToRecycleBin(String courseId) { - WebElement moveArchivedToRecycleBinButton = getMoveArchivedToRecycleBinButton(courseId); - clickAndConfirm(moveArchivedToRecycleBinButton); - - waitUntilAnimationFinish(); - } - public void showDeleteTable() { if (!isElementVisible(By.id("deleted-course-id-0"))) { click(By.id("deleted-table-heading")); } } - public void showArchiveTable() { - if (!isElementVisible(By.id("archived-course-id-0"))) { - click(By.id("archived-table-heading")); - } - } - public void restoreCourse(String courseId) { WebElement restoreButton = getRestoreButton(courseId); click(restoreButton); @@ -249,11 +203,6 @@ private WebElement getActiveTableRow(String courseId) { return getActiveCoursesTable().findElements(By.cssSelector("tbody tr")).get(courseRowNumber); } - private WebElement getArchivedTableRow(String courseId) { - int courseRowNumber = getRowNumberOfArchivedCourse(courseId); - return getArchivedCoursesTable().findElements(By.cssSelector("tbody tr")).get(courseRowNumber); - } - private WebElement getDeletedTableRow(String courseId) { int courseRowNumber = getRowNumberOfDeletedCourse(courseId); return getDeletedCoursesTable().findElements(By.cssSelector("tbody tr")).get(courseRowNumber); @@ -316,11 +265,6 @@ private WebElement getOtherActionsButton(String courseId) { return getOtherActionsButtonInRow(courseRowNumber); } - private WebElement getArchiveButton(String courseId) { - int courseRowNumber = getRowNumberOfCourse(courseId); - return getArchiveButtonInRow(courseRowNumber); - } - private WebElement getCopyButton(String courseId) { int courseRowNumber = getRowNumberOfCourse(courseId); return getCopyButtonInRow(courseRowNumber); @@ -331,16 +275,6 @@ private WebElement getMoveToRecycleBinButton(String courseId) { return getMoveToRecycleBinButtonInRow(courseRowNumber); } - private WebElement getUnarchiveButton(String courseId) { - int courseRowNumber = getRowNumberOfArchivedCourse(courseId); - return getUnarchiveButtonInRow(courseRowNumber); - } - - private WebElement getMoveArchivedToRecycleBinButton(String courseId) { - int courseRowNumber = getRowNumberOfArchivedCourse(courseId); - return getMoveArchivedToRecycleBinButtonInRow(courseRowNumber); - } - private WebElement getRestoreButton(String courseId) { showDeleteTable(); int courseRowNumber = getRowNumberOfDeletedCourse(courseId); @@ -361,14 +295,6 @@ private int getCourseCount() { } } - private int getArchivedCourseCount() { - try { - return getArchivedCoursesTable().findElements(By.cssSelector("tbody tr")).size(); - } catch (NoSuchElementException e) { - return 0; - } - } - private int getDeletedCourseCount() { try { return getDeletedCoursesTable().findElements(By.cssSelector("tbody tr")).size(); @@ -386,15 +312,6 @@ private int getRowNumberOfCourse(String courseId) { return -1; } - private int getRowNumberOfArchivedCourse(String courseId) { - for (int i = 0; i < getArchivedCourseCount(); i++) { - if (getArchivedCourseIdCell(i).getText().equals(courseId)) { - return i; - } - } - return -1; - } - private int getRowNumberOfDeletedCourse(String courseId) { for (int i = 0; i < getDeletedCourseCount(); i++) { if (getDeletedCourseIdCell(i).getText().equals(courseId)) { @@ -408,10 +325,6 @@ private WebElement getCourseIdCell(int rowId) { return browser.driver.findElement(By.id("course-id-" + rowId)); } - private WebElement getArchivedCourseIdCell(int rowId) { - return browser.driver.findElement(By.id("archived-course-id-" + rowId)); - } - private WebElement getDeletedCourseIdCell(int rowId) { return browser.driver.findElement(By.id("deleted-course-id-" + rowId)); } @@ -426,11 +339,6 @@ private WebElement getOtherActionsButtonInRow(int rowId) { return browser.driver.findElement(otherActionsButton); } - private WebElement getArchiveButtonInRow(int rowId) { - By archiveButton = By.id("btn-archive-" + rowId); - return browser.driver.findElement(archiveButton); - } - private WebElement getCopyButtonInRow(int rowId) { By copyButton = By.id("btn-copy-" + rowId); return browser.driver.findElement(copyButton); @@ -441,16 +349,6 @@ private WebElement getMoveToRecycleBinButtonInRow(int rowId) { return browser.driver.findElement(moveToRecycleBinButton); } - private WebElement getUnarchiveButtonInRow(int rowId) { - By archiveButton = By.id("btn-unarchive-" + rowId); - return browser.driver.findElement(archiveButton); - } - - private WebElement getMoveArchivedToRecycleBinButtonInRow(int rowId) { - By moveToRecycleBinButton = By.id("btn-soft-delete-archived-" + rowId); - return browser.driver.findElement(moveToRecycleBinButton); - } - private WebElement getRestoreButtonInRow(int rowId) { By restoreButton = By.id("btn-restore-" + rowId); return browser.driver.findElement(restoreButton); diff --git a/src/e2e/java/teammates/e2e/pageobjects/InstructorHomePage.java b/src/e2e/java/teammates/e2e/pageobjects/InstructorHomePage.java index b6f681533d2..7f71bc7cffa 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/InstructorHomePage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/InstructorHomePage.java @@ -108,13 +108,6 @@ public void deleteSession(int courseTabIndex, int sessionIndex) { waitUntilAnimationFinish(); } - public void archiveCourse(int courseTabIndex) { - WebElement courseTab = getCourseTab(courseTabIndex); - click(courseTab.findElement(By.id("btn-course"))); - clickAndConfirm(courseTab.findElement(By.id("btn-archive-course"))); - waitUntilAnimationFinish(); - } - public void deleteCourse(int courseTabIndex) { WebElement courseTab = getCourseTab(courseTabIndex); click(courseTab.findElement(By.id("btn-course"))); diff --git a/src/e2e/resources/data/AdminHomePageE2ETest.json b/src/e2e/resources/data/AdminHomePageE2ETest.json index 096891c9ab7..600a29d9eee 100644 --- a/src/e2e/resources/data/AdminHomePageE2ETest.json +++ b/src/e2e/resources/data/AdminHomePageE2ETest.json @@ -30,7 +30,6 @@ "courseId": "tm.e2e.AHome.course1", "name": "Teammates Instr1", "email": "AHome.instr1@gmail.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", diff --git a/src/e2e/resources/data/InstructorCourseEditPageE2ETest.json b/src/e2e/resources/data/InstructorCourseEditPageE2ETest.json index 69835fa24a3..041de962d7a 100644 --- a/src/e2e/resources/data/InstructorCourseEditPageE2ETest.json +++ b/src/e2e/resources/data/InstructorCourseEditPageE2ETest.json @@ -244,7 +244,6 @@ "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", - "isArchived": true, "privileges": { "courseLevel": { "canViewStudentInSections": true, diff --git a/src/e2e/resources/data/InstructorCoursesPageE2ETest.json b/src/e2e/resources/data/InstructorCoursesPageE2ETest.json index 7b60a31abb1..7d09e5544ce 100644 --- a/src/e2e/resources/data/InstructorCoursesPageE2ETest.json +++ b/src/e2e/resources/data/InstructorCoursesPageE2ETest.json @@ -93,7 +93,6 @@ "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", - "isArchived": true, "privileges": { "courseLevel": { "canViewStudentInSections": true, diff --git a/src/e2e/resources/data/InstructorNotificationsPageE2ETest.json b/src/e2e/resources/data/InstructorNotificationsPageE2ETest.json index 538be7ac54c..5e40985ddd0 100644 --- a/src/e2e/resources/data/InstructorNotificationsPageE2ETest.json +++ b/src/e2e/resources/data/InstructorNotificationsPageE2ETest.json @@ -23,7 +23,6 @@ "courseId": "tm.e2e.INotifs.course1", "name": "Teammates Instr1", "email": "INotifs.instr@gmail.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", diff --git a/src/e2e/resources/data/InstructorStudentListPageE2ETest.json b/src/e2e/resources/data/InstructorStudentListPageE2ETest.json index 9dc73d1f821..da66a7b3d12 100644 --- a/src/e2e/resources/data/InstructorStudentListPageE2ETest.json +++ b/src/e2e/resources/data/InstructorStudentListPageE2ETest.json @@ -39,7 +39,6 @@ "courseId": "tm.e2e.ISList.course1", "name": "Instructor1 Course1", "email": "ISList.instr1@gmail.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -63,7 +62,6 @@ "courseId": "tm.e2e.ISList.course2", "name": "Instructor1 Course2", "email": "ISList.instr1@gmail.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -87,7 +85,6 @@ "courseId": "tm.e2e.ISList.course3", "name": "Instructor1 Course3", "email": "ISList.instr1@gmail.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", diff --git a/src/main/appengine/index.yaml b/src/main/appengine/index.yaml index db65f2b21b8..a7317298b0a 100644 --- a/src/main/appengine/index.yaml +++ b/src/main/appengine/index.yaml @@ -17,8 +17,6 @@ indexes: properties: - direction: asc name: googleId - - direction: asc - name: isArchived - kind: FeedbackSession properties: - direction: asc diff --git a/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java index ab7fb598466..d1a9bd32220 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java @@ -26,7 +26,6 @@ public final class InstructorAttributes extends EntityAttributes { private String googleId; private String role; private String displayedName; - private boolean isArchived; private boolean isDisplayedToStudents; private InstructorPrivileges privileges; private transient String key; @@ -39,7 +38,6 @@ private InstructorAttributes(String courseId, String email) { this.role = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; this.displayedName = Const.DEFAULT_DISPLAY_NAME_FOR_INSTRUCTOR; - this.isArchived = false; this.isDisplayedToStudents = true; this.privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); @@ -70,7 +68,6 @@ public static InstructorAttributes valueOf(Instructor instructor) { if (instructor.getDisplayedName() != null) { instructorAttributes.displayedName = instructor.getDisplayedName(); } - instructorAttributes.isArchived = instructor.getIsArchived(); instructorAttributes.isDisplayedToStudents = instructor.isDisplayedToStudents(); if (instructor.getInstructorPrivilegesAsText() == null) { @@ -101,7 +98,6 @@ public InstructorAttributes getCopy() { instructorAttributes.key = key; instructorAttributes.role = role; instructorAttributes.displayedName = displayedName; - instructorAttributes.isArchived = isArchived; instructorAttributes.isDisplayedToStudents = isDisplayedToStudents; instructorAttributes.privileges = privileges; instructorAttributes.createdAt = createdAt; @@ -130,14 +126,6 @@ public void setKey(String key) { this.key = key; } - public boolean isArchived() { - return isArchived; - } - - public void setArchived(boolean archived) { - isArchived = archived; - } - public InstructorPrivileges getPrivileges() { return privileges; } @@ -183,7 +171,7 @@ public String getRegistrationUrl() { @Override public Instructor toEntity() { - return new Instructor(googleId, courseId, isArchived, name, email, role, + return new Instructor(googleId, courseId, name, email, role, isDisplayedToStudents, displayedName, getInstructorPrivilegesAsText()); } @@ -376,7 +364,6 @@ public void update(UpdateOptionsWithGoogleId updateOptions) { private void updateBasic(UpdateOptions updateOptions) { updateOptions.nameOption.ifPresent(s -> name = s); - updateOptions.isArchivedOption.ifPresent(s -> isArchived = s); updateOptions.roleOption.ifPresent(s -> role = s); updateOptions.isDisplayedToStudentsOption.ifPresent(s -> isDisplayedToStudents = s); updateOptions.instructorPrivilegesOption.ifPresent(s -> privileges = s); @@ -561,7 +548,6 @@ public UpdateOptionsWithGoogleId build() { private static class UpdateOptions { UpdateOption nameOption = UpdateOption.empty(); - UpdateOption isArchivedOption = UpdateOption.empty(); UpdateOption roleOption = UpdateOption.empty(); UpdateOption isDisplayedToStudentsOption = UpdateOption.empty(); UpdateOption displayedNameOption = UpdateOption.empty(); @@ -571,7 +557,6 @@ private static class UpdateOptions { public String toString() { return "InstructorAttributes.UpdateOptions [" + "name = " + nameOption - + ", isAchieved = " + isArchivedOption + ", roleOption = " + roleOption + ", isDisplayedToStudents = " + isDisplayedToStudentsOption + ", displayedName = " + displayedNameOption @@ -628,11 +613,6 @@ public B withIsDisplayedToStudents(boolean isDisplayedToStudents) { return thisBuilder; } - public B withIsArchived(boolean isAchieved) { - updateOptions.isArchivedOption = UpdateOption.of(isAchieved); - return thisBuilder; - } - public abstract T build(); } diff --git a/src/main/java/teammates/common/util/Const.java b/src/main/java/teammates/common/util/Const.java index a945b5abb07..d096effa664 100644 --- a/src/main/java/teammates/common/util/Const.java +++ b/src/main/java/teammates/common/util/Const.java @@ -204,7 +204,6 @@ public static class HeaderNames { */ public static class CourseStatus { public static final String ACTIVE = "active"; - public static final String ARCHIVED = "archived"; public static final String SOFT_DELETED = "softDeleted"; } @@ -326,7 +325,6 @@ public static class ResourceURIs { public static final String ACCOUNTS = URI_PREFIX + "/accounts"; public static final String RESPONSE_COMMENT = URI_PREFIX + "/responsecomment"; public static final String COURSE = URI_PREFIX + "/course"; - public static final String COURSE_ARCHIVE = URI_PREFIX + "/course/archive"; public static final String BIN_COURSE = URI_PREFIX + "/bin/course"; public static final String COURSE_SECTIONS = URI_PREFIX + "/course/sections"; public static final String COURSES = URI_PREFIX + "/courses"; diff --git a/src/main/java/teammates/logic/api/Logic.java b/src/main/java/teammates/logic/api/Logic.java index f1edc2bfbcd..e6bcec8210b 100644 --- a/src/main/java/teammates/logic/api/Logic.java +++ b/src/main/java/teammates/logic/api/Logic.java @@ -353,13 +353,6 @@ public List getInstructorsForGoogleId(String googleId) { return instructorsLogic.getInstructorsForGoogleId(googleId); } - public List getInstructorsForGoogleId(String googleId, boolean omitArchived) { - - assert googleId != null; - - return instructorsLogic.getInstructorsForGoogleId(googleId, omitArchived); - } - /** * Preconditions:
* * All parameters are non-null. @@ -523,24 +516,6 @@ public CourseAttributes updateCourseCascade(CourseAttributes.UpdateOptions updat return coursesLogic.updateCourseCascade(updateOptions); } - /** - * Changes the archive status of a course for an instructor. - * - *
Preconditions:
- * * All parameters are non-null. - * - * @param courseId The course of which the archive status is to be changed - * @param archiveStatus The archive status to be set - */ - public void setArchiveStatusOfInstructor(String googleId, String courseId, boolean archiveStatus) - throws InvalidParametersException, EntityDoesNotExistException { - - assert googleId != null; - assert courseId != null; - - instructorsLogic.setArchiveStatusOfInstructor(googleId, courseId, archiveStatus); - } - /** * Deletes a course cascade its students, instructors, sessions, responses, deadline extensions and comments. * @@ -1010,7 +985,7 @@ public List getFeedbackSessionsListForInstructor( /** * Returns a {@code List} of feedback sessions in the Recycle Bin for the instructors. *
- * Omits sessions if the corresponding courses are archived or in Recycle Bin + * Omits sessions if the corresponding courses are in Recycle Bin */ public List getSoftDeletedFeedbackSessionsListForInstructors( List instructorList) { diff --git a/src/main/java/teammates/logic/core/AccountsLogic.java b/src/main/java/teammates/logic/core/AccountsLogic.java index 4fa927254d3..f8eae5b21e8 100644 --- a/src/main/java/teammates/logic/core/AccountsLogic.java +++ b/src/main/java/teammates/logic/core/AccountsLogic.java @@ -250,7 +250,7 @@ public void deleteAccountCascade(String googleId) { // to prevent orphan course List instructorsToDelete = - instructorsLogic.getInstructorsForGoogleId(googleId, false); + instructorsLogic.getInstructorsForGoogleId(googleId); for (InstructorAttributes instructorToDelete : instructorsToDelete) { if (instructorsLogic.getInstructorsForCourse(instructorToDelete.getCourseId()).size() <= 1) { // the instructor is the last instructor in the course diff --git a/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java b/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java index 120d3797d1c..960f615c0f0 100644 --- a/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java +++ b/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java @@ -143,7 +143,7 @@ public List getFeedbackSessionsListForInstructor( /** * Returns a {@code List} of feedback sessions in the Recycle Bin for the instructors. *
- * Omits sessions if the corresponding courses are archived or in Recycle Bin + * Omits sessions if the corresponding courses are in Recycle Bin */ public List getSoftDeletedFeedbackSessionsListForInstructors( List instructorList) { diff --git a/src/main/java/teammates/logic/core/InstructorsLogic.java b/src/main/java/teammates/logic/core/InstructorsLogic.java index 0af7387f933..5dd05817052 100644 --- a/src/main/java/teammates/logic/core/InstructorsLogic.java +++ b/src/main/java/teammates/logic/core/InstructorsLogic.java @@ -88,19 +88,6 @@ public InstructorAttributes createInstructor(InstructorAttributes instructorToAd return instructorsDb.createEntity(instructorToAdd); } - /** - * Sets the archive status of an instructor (i.e. whether the instructor - * decides to archive the associated course or not). - */ - public void setArchiveStatusOfInstructor(String googleId, String courseId, boolean archiveStatus) - throws InvalidParametersException, EntityDoesNotExistException { - instructorsDb.updateInstructorByGoogleId( - InstructorAttributes.updateOptionsWithGoogleIdBuilder(courseId, googleId) - .withIsArchived(archiveStatus) - .build() - ); - } - /** * Checks if all the given instructors exist in the given course. * @@ -163,20 +150,11 @@ public List getInstructorsForCourse(String courseId) { return instructorReturnList; } - /** - * Gets all non-archived instructors associated with a googleId. - */ - public List getInstructorsForGoogleId(String googleId) { - return getInstructorsForGoogleId(googleId, false); - } - /** * Gets all instructors associated with a googleId. - * - * @param omitArchived whether archived instructors should be omitted or not */ - public List getInstructorsForGoogleId(String googleId, boolean omitArchived) { - return instructorsDb.getInstructorsForGoogleId(googleId, omitArchived); + public List getInstructorsForGoogleId(String googleId) { + return instructorsDb.getInstructorsForGoogleId(googleId); } /** @@ -332,7 +310,7 @@ public void deleteInstructorCascade(String courseId, String email) { * deadline extensions and comments. */ public void deleteInstructorsForGoogleIdCascade(String googleId) { - List instructors = instructorsDb.getInstructorsForGoogleId(googleId, false); + List instructors = instructorsDb.getInstructorsForGoogleId(googleId); // cascade delete instructors for (InstructorAttributes instructor : instructors) { diff --git a/src/main/java/teammates/storage/api/InstructorsDb.java b/src/main/java/teammates/storage/api/InstructorsDb.java index ae270ff18a3..2eb1074271a 100644 --- a/src/main/java/teammates/storage/api/InstructorsDb.java +++ b/src/main/java/teammates/storage/api/InstructorsDb.java @@ -157,13 +157,11 @@ public InstructorAttributes getInstructorForRegistrationKey(String registrationK /** * Gets all instructors associated with a googleId. - * - * @param omitArchived whether archived instructors should be omitted or not */ - public List getInstructorsForGoogleId(String googleId, boolean omitArchived) { + public List getInstructorsForGoogleId(String googleId) { assert googleId != null; - return makeAttributes(getInstructorEntitiesForGoogleId(googleId, omitArchived)); + return makeAttributes(getInstructorEntitiesForGoogleId(googleId)); } /** @@ -226,7 +224,6 @@ public InstructorAttributes updateInstructorByGoogleId(InstructorAttributes.Upda boolean hasSameAttributes = this.hasSameValue(instructor.getName(), newAttributes.getName()) && this.hasSameValue(instructor.getEmail(), newAttributes.getEmail()) - && this.hasSameValue(instructor.getIsArchived(), newAttributes.isArchived()) && this.hasSameValue(instructor.getRole(), newAttributes.getRole()) && this.hasSameValue(instructor.isDisplayedToStudents(), newAttributes.isDisplayedToStudents()) && this.hasSameValue(instructor.getDisplayedName(), newAttributes.getDisplayedName()) @@ -240,7 +237,6 @@ public InstructorAttributes updateInstructorByGoogleId(InstructorAttributes.Upda instructor.setName(newAttributes.getName()); instructor.setEmail(newAttributes.getEmail()); - instructor.setIsArchived(newAttributes.isArchived()); instructor.setRole(newAttributes.getRole()); instructor.setIsDisplayedToStudents(newAttributes.isDisplayedToStudents()); instructor.setDisplayedName(newAttributes.getDisplayedName()); @@ -281,7 +277,6 @@ public InstructorAttributes updateInstructorByEmail(InstructorAttributes.UpdateO boolean hasSameAttributes = this.hasSameValue(instructor.getName(), newAttributes.getName()) && this.hasSameValue(instructor.getGoogleId(), newAttributes.getGoogleId()) - && this.hasSameValue(instructor.getIsArchived(), newAttributes.isArchived()) && this.hasSameValue(instructor.getRole(), newAttributes.getRole()) && this.hasSameValue(instructor.isDisplayedToStudents(), newAttributes.isDisplayedToStudents()) && this.hasSameValue(instructor.getDisplayedName(), newAttributes.getDisplayedName()) @@ -294,7 +289,6 @@ public InstructorAttributes updateInstructorByEmail(InstructorAttributes.UpdateO instructor.setGoogleId(newAttributes.getGoogleId()); instructor.setName(newAttributes.getName()); - instructor.setIsArchived(newAttributes.isArchived()); instructor.setRole(newAttributes.getRole()); instructor.setIsDisplayedToStudents(newAttributes.isDisplayedToStudents()); instructor.setDisplayedName(newAttributes.getDisplayedName()); @@ -445,43 +439,6 @@ private List getInstructorEntitiesForGoogleId(String googleId) { return load().filter("googleId =", googleId).list(); } - /** - * Omits instructors with isArchived == omitArchived. - * This means that the corresponding course is archived by the instructor. - */ - private List getInstructorEntitiesForGoogleId(String googleId, boolean omitArchived) { - if (omitArchived) { - if (googleId.toLowerCase().contains("@gmail.com")) { - List instructorsWithGoogleId = load() - .filter("googleId =", googleId.split("@")[0]) - .filter("isArchived =", false) - .list(); - List instructorsWithEmail = load() - .filter("googleId =", googleId) - .filter("isArchived =", false) - .list(); - instructorsWithGoogleId.addAll(instructorsWithEmail); - return instructorsWithGoogleId; - } - if (!googleId.toLowerCase().contains("@")) { - List instructorsWithGoogleId = load() - .filter("googleId =", googleId) - .filter("isArchived =", false) - .list(); - List instructorsWithEmail = load() - .filter("googleId =", googleId.concat("@gmail.com")) - .filter("isArchived =", false) - .list(); - instructorsWithGoogleId.addAll(instructorsWithEmail); - return instructorsWithGoogleId; - } - return load().filter("googleId =", googleId) - .filter("isArchived =", false) - .list(); - } - return getInstructorEntitiesForGoogleId(googleId); - } - private List getInstructorEntitiesForCourse(String courseId) { return load().filter("courseId =", courseId).list(); } diff --git a/src/main/java/teammates/storage/entity/Instructor.java b/src/main/java/teammates/storage/entity/Instructor.java index 282716d629c..5d75a9dc98d 100644 --- a/src/main/java/teammates/storage/entity/Instructor.java +++ b/src/main/java/teammates/storage/entity/Instructor.java @@ -36,9 +36,6 @@ public class Instructor extends BaseEntity { /** The foreign key to locate the Course object. */ private String courseId; - /** Whether the associated course is archived. */ - private boolean isArchived; - /** The instructor's name used for this course. */ private String name; @@ -70,12 +67,11 @@ private Instructor() { // required by Objectify } - public Instructor(String instructorGoogleId, String courseId, boolean isArchived, String instructorName, + public Instructor(String instructorGoogleId, String courseId, String instructorName, String instructorEmail, String role, boolean isDisplayedToStudents, String displayedName, String instructorPrivilegesAsText) { this.setGoogleId(instructorGoogleId); this.setCourseId(courseId); - this.setIsArchived(isArchived); this.setName(instructorName); this.setEmail(instructorEmail); this.setRole(role); @@ -129,17 +125,6 @@ public void setCourseId(String courseId) { this.courseId = courseId; } - /** - * Gets the archived status of the instructor. - */ - public boolean getIsArchived() { - return isArchived; - } - - public void setIsArchived(boolean isArchived) { - this.isArchived = isArchived; - } - public String getName() { return name; } diff --git a/src/main/java/teammates/ui/constants/ResourceEndpoints.java b/src/main/java/teammates/ui/constants/ResourceEndpoints.java index 1ed6154334e..79ea7c4fb37 100644 --- a/src/main/java/teammates/ui/constants/ResourceEndpoints.java +++ b/src/main/java/teammates/ui/constants/ResourceEndpoints.java @@ -19,7 +19,6 @@ public enum ResourceEndpoints { ACCOUNTS(ResourceURIs.ACCOUNTS), RESPONSE_COMMENT(ResourceURIs.RESPONSE_COMMENT), COURSE(ResourceURIs.COURSE), - COURSE_ARCHIVE(ResourceURIs.COURSE_ARCHIVE), BIN_COURSE(ResourceURIs.BIN_COURSE), COURSE_SECTIONS(ResourceURIs.COURSE_SECTIONS), COURSES(ResourceURIs.COURSES), diff --git a/src/main/java/teammates/ui/output/CourseArchiveData.java b/src/main/java/teammates/ui/output/CourseArchiveData.java deleted file mode 100644 index 2f5021bc79a..00000000000 --- a/src/main/java/teammates/ui/output/CourseArchiveData.java +++ /dev/null @@ -1,23 +0,0 @@ -package teammates.ui.output; - -/** - * The API output format of a archived course status. - */ -public class CourseArchiveData extends ApiOutput { - - private final String courseId; - private final boolean isArchived; - - public CourseArchiveData(String courseId, boolean isArchived) { - this.courseId = courseId; - this.isArchived = isArchived; - } - - public String getCourseId() { - return courseId; - } - - public boolean getIsArchived() { - return isArchived; - } -} diff --git a/src/main/java/teammates/ui/request/CourseArchiveRequest.java b/src/main/java/teammates/ui/request/CourseArchiveRequest.java deleted file mode 100644 index 8e29c81a6da..00000000000 --- a/src/main/java/teammates/ui/request/CourseArchiveRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package teammates.ui.request; - -/** - * The archive request of a course. - */ -public class CourseArchiveRequest extends BasicRequest { - private boolean archiveStatus; - - @Override - public void validate() { - //nothing to validate - } - - public boolean getArchiveStatus() { - return archiveStatus; - } - - public void setArchiveStatus(boolean archiveStatus) { - this.archiveStatus = archiveStatus; - } -} diff --git a/src/main/java/teammates/ui/webapi/ActionFactory.java b/src/main/java/teammates/ui/webapi/ActionFactory.java index 6daf2271beb..060c69f0aa1 100644 --- a/src/main/java/teammates/ui/webapi/ActionFactory.java +++ b/src/main/java/teammates/ui/webapi/ActionFactory.java @@ -54,7 +54,6 @@ public final class ActionFactory { map(ResourceURIs.COURSE, DELETE, DeleteCourseAction.class); map(ResourceURIs.COURSE, POST, CreateCourseAction.class); map(ResourceURIs.COURSE, PUT, UpdateCourseAction.class); - map(ResourceURIs.COURSE_ARCHIVE, PUT, ArchiveCourseAction.class); map(ResourceURIs.DEADLINE_EXTENSION, GET, GetDeadlineExtensionAction.class); map(ResourceURIs.BIN_COURSE, PUT, BinCourseAction.class); map(ResourceURIs.BIN_COURSE, DELETE, RestoreCourseAction.class); diff --git a/src/main/java/teammates/ui/webapi/ArchiveCourseAction.java b/src/main/java/teammates/ui/webapi/ArchiveCourseAction.java deleted file mode 100644 index d1764132821..00000000000 --- a/src/main/java/teammates/ui/webapi/ArchiveCourseAction.java +++ /dev/null @@ -1,52 +0,0 @@ -package teammates.ui.webapi; - -import org.apache.http.HttpStatus; - -import teammates.common.exception.EntityDoesNotExistException; -import teammates.common.exception.InvalidParametersException; -import teammates.common.util.Const; -import teammates.common.util.Logger; -import teammates.ui.output.CourseArchiveData; -import teammates.ui.request.CourseArchiveRequest; -import teammates.ui.request.InvalidHttpRequestBodyException; - -/** - * Changes the archive status of a course. - */ -class ArchiveCourseAction extends Action { - - private static final Logger log = Logger.getLogger(); - - @Override - AuthType getMinAuthLevel() { - return AuthType.LOGGED_IN; - } - - @Override - void checkSpecificAccessControl() throws UnauthorizedAccessException { - String idOfCourseToArchive = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); - gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(idOfCourseToArchive, userInfo.id), - logic.getCourse(idOfCourseToArchive)); - } - - @Override - public JsonResult execute() throws InvalidHttpRequestBodyException { - String idOfCourseToArchive = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); - - CourseArchiveRequest courseArchiveRequest = getAndValidateRequestBody(CourseArchiveRequest.class); - - boolean isArchive = courseArchiveRequest.getArchiveStatus(); - try { - // Set the archive status and status shown to user and admin - logic.setArchiveStatusOfInstructor(userInfo.id, idOfCourseToArchive, isArchive); - } catch (InvalidParametersException e) { - // There should not be any invalid parameter here - log.severe("Unexpected error", e); - return new JsonResult(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); - } catch (EntityDoesNotExistException e) { - throw new EntityNotFoundException(e); - } - - return new JsonResult(new CourseArchiveData(idOfCourseToArchive, isArchive)); - } -} diff --git a/src/main/java/teammates/ui/webapi/GetCoursesAction.java b/src/main/java/teammates/ui/webapi/GetCoursesAction.java index d0c07972fbf..0da3a3e24fb 100644 --- a/src/main/java/teammates/ui/webapi/GetCoursesAction.java +++ b/src/main/java/teammates/ui/webapi/GetCoursesAction.java @@ -3,7 +3,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import teammates.common.datatransfer.InstructorPermissionSet; import teammates.common.datatransfer.attributes.CourseAttributes; @@ -13,7 +12,7 @@ import teammates.ui.output.CoursesData; /** - * Gets all courses for the instructor, and filtered by active, archived and soft-deleted. + * Gets all courses for the instructor, and filtered by active and soft-deleted. * Or gets all courses for the student he belongs to. */ class GetCoursesAction extends Action { @@ -59,14 +58,7 @@ private JsonResult getInstructorCourses() { List instructors; switch (courseStatus) { case Const.CourseStatus.ACTIVE: - instructors = logic.getInstructorsForGoogleId(userInfo.id, true); - courses = getCourse(instructors); - break; - case Const.CourseStatus.ARCHIVED: - instructors = logic.getInstructorsForGoogleId(userInfo.id) - .stream() - .filter(InstructorAttributes::isArchived) - .collect(Collectors.toList()); + instructors = logic.getInstructorsForGoogleId(userInfo.id); courses = getCourse(instructors); break; case Const.CourseStatus.SOFT_DELETED: diff --git a/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java b/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java index 0dc59752d7a..084ad395bc8 100644 --- a/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java +++ b/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java @@ -89,7 +89,7 @@ public JsonResult execute() { } else if (entityType.equals(Const.EntityType.INSTRUCTOR)) { boolean isInRecycleBin = getBooleanRequestParamValue(Const.ParamsNames.IS_IN_RECYCLE_BIN); - instructors = logic.getInstructorsForGoogleId(userInfo.getId(), true); + instructors = logic.getInstructorsForGoogleId(userInfo.getId()); if (isInRecycleBin) { feedbackSessionAttributes = logic.getSoftDeletedFeedbackSessionsListForInstructors(instructors); diff --git a/src/main/resources/logsForLocalDev.json b/src/main/resources/logsForLocalDev.json index 66d5c04a118..8e19cc831aa 100644 --- a/src/main/resources/logsForLocalDev.json +++ b/src/main/resources/logsForLocalDev.json @@ -1353,8 +1353,7 @@ "sec-fetch-dest": "empty" }, "requestParams": { - "entitytype": "instructor", - "coursestatus": "archived" + "entitytype": "instructor" } }, "resourceIdentifier": { diff --git a/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java b/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java index 299ce58df3b..41c41a3d753 100644 --- a/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java +++ b/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java @@ -32,7 +32,6 @@ public void testBuilder_buildNothing_shouldUseDefaultValues() { assertNull(instructor.getKey()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER, instructor.getRole()); assertEquals(Const.DEFAULT_DISPLAY_NAME_FOR_INSTRUCTOR, instructor.getDisplayedName()); - assertFalse(instructor.isArchived()); assertTrue(instructor.isDisplayedToStudents()); assertEquals(new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER), instructor.getPrivileges()); @@ -96,7 +95,6 @@ public void testBuilder_withTypicalData_shouldBuildCorrectAttribute() { .withGoogleId("valid.google.id") .withRole(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER) .withDisplayedName("instructor A") - .withIsArchived(false) .withIsDisplayedToStudents(false) .withPrivileges( new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER)) @@ -107,7 +105,6 @@ public void testBuilder_withTypicalData_shouldBuildCorrectAttribute() { assertEquals("valid name", instructor.getName()); assertEquals("valid.google.id", instructor.getGoogleId()); assertEquals("instructor A", instructor.getDisplayedName()); - assertFalse(instructor.isArchived()); assertFalse(instructor.isDisplayedToStudents()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER, instructor.getRole()); assertEquals(new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER), @@ -120,14 +117,13 @@ public void testBuilder_withTypicalData_shouldBuildCorrectAttribute() { public void testValueOf_withAllFieldPopulatedInstructor_shouldGenerateAttributesCorrectly() { InstructorPrivileges privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); - Instructor instructor = new Instructor("valid.google.id", "valid-course-id", false, + Instructor instructor = new Instructor("valid.google.id", "valid-course-id", "valid name", "valid@email.com", Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER, true, "Tutor", JsonUtils.toJson(privileges.toLegacyFormat(), InstructorPrivilegesLegacy.class)); InstructorAttributes instructorAttributes = InstructorAttributes.valueOf(instructor); assertEquals(instructor.getGoogleId(), instructorAttributes.getGoogleId()); assertEquals(instructor.getCourseId(), instructorAttributes.getCourseId()); - assertEquals(instructor.getIsArchived(), instructorAttributes.isArchived()); assertEquals(instructor.getName(), instructorAttributes.getName()); assertEquals(instructor.getEmail(), instructorAttributes.getEmail()); assertEquals(instructor.getRegistrationKey(), instructorAttributes.getKey()); @@ -142,14 +138,13 @@ public void testValueOf_withAllFieldPopulatedInstructor_shouldGenerateAttributes @Test public void testValueOf_withSomeFieldsPopulatedAsNull_shouldUseDefaultValues() { - Instructor instructor = new Instructor("valid.google.id", "valid-course-id", false, + Instructor instructor = new Instructor("valid.google.id", "valid-course-id", "valid name", "valid@email.com", null, true, null, null); InstructorAttributes instructorAttributes = InstructorAttributes.valueOf(instructor); assertEquals(instructor.getGoogleId(), instructorAttributes.getGoogleId()); assertEquals(instructor.getCourseId(), instructorAttributes.getCourseId()); - assertEquals(instructor.getIsArchived(), instructorAttributes.isArchived()); assertEquals(instructor.getName(), instructorAttributes.getName()); assertEquals(instructor.getEmail(), instructorAttributes.getEmail()); assertEquals(instructor.getRegistrationKey(), instructorAttributes.getKey()); @@ -324,7 +319,6 @@ public void testUpdateOptionsWithEmail_withTypicalData_shouldUpdateAttributeCorr InstructorAttributes.updateOptionsWithEmailBuilder("courseId", "test@test.com") .withName("test") .withDisplayedName("Instructor") - .withIsArchived(false) .withPrivileges(new InstructorPrivileges( Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER)) .withIsDisplayedToStudents(false) @@ -340,7 +334,6 @@ public void testUpdateOptionsWithEmail_withTypicalData_shouldUpdateAttributeCorr .withGoogleId("testGoogleId") .withName("test2") .withDisplayedName("Tutor") - .withIsArchived(true) .withPrivileges(new InstructorPrivileges( Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER)) .withIsDisplayedToStudents(true) @@ -351,7 +344,6 @@ public void testUpdateOptionsWithEmail_withTypicalData_shouldUpdateAttributeCorr assertEquals("test", instructorAttributes.getName()); assertEquals("Instructor", instructorAttributes.getDisplayedName()); - assertFalse(instructorAttributes.isArchived()); assertTrue(instructorAttributes.getPrivileges().hasManagerPrivileges()); assertFalse(instructorAttributes.isDisplayedToStudents()); assertEquals("googleId", instructorAttributes.getGoogleId()); @@ -365,7 +357,6 @@ public void testUpdateOptionsWithGoogleId_withTypicalData_shouldUpdateAttributeC .withName("test") .withEmail("test@email.com") .withDisplayedName("Instructor") - .withIsArchived(false) .withPrivileges(new InstructorPrivileges( Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_MANAGER)) .withIsDisplayedToStudents(false) @@ -380,7 +371,6 @@ public void testUpdateOptionsWithGoogleId_withTypicalData_shouldUpdateAttributeC .withGoogleId("googleId") .withName("test2") .withDisplayedName("Tutor") - .withIsArchived(true) .withPrivileges(new InstructorPrivileges( Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER)) .withIsDisplayedToStudents(true) @@ -391,7 +381,6 @@ public void testUpdateOptionsWithGoogleId_withTypicalData_shouldUpdateAttributeC assertEquals("test", instructorAttributes.getName()); assertEquals("Instructor", instructorAttributes.getDisplayedName()); - assertFalse(instructorAttributes.isArchived()); assertTrue(instructorAttributes.getPrivileges().hasManagerPrivileges()); assertFalse(instructorAttributes.isDisplayedToStudents()); assertEquals("test@email.com", instructorAttributes.getEmail()); diff --git a/src/test/java/teammates/logic/core/AccountsLogicTest.java b/src/test/java/teammates/logic/core/AccountsLogicTest.java index af0efb5e691..5b65cbefef9 100644 --- a/src/test/java/teammates/logic/core/AccountsLogicTest.java +++ b/src/test/java/teammates/logic/core/AccountsLogicTest.java @@ -419,27 +419,6 @@ public void testDeleteAccountCascade_notLastInstructorInCourse_shouldNotDeleteCo assertNotNull(coursesLogic.getCourse(instructor1OfCourse1.getCourseId())); } - @Test - public void testDeleteAccountCascade_instructorArchivedAsLastInstructor_shouldDeleteCourseAlso() throws Exception { - InstructorAttributes instructor5 = dataBundle.instructors.get("instructor5"); - - assertNotNull(instructor5.getGoogleId()); - instructorsLogic.setArchiveStatusOfInstructor(instructor5.getGoogleId(), instructor5.getCourseId(), true); - - // verify the instructor is the last instructor of a course - assertEquals(1, instructorsLogic.getInstructorsForCourse(instructor5.getCourseId()).size()); - - assertTrue( - instructorsLogic.getInstructorForEmail(instructor5.getCourseId(), instructor5.getEmail()).isArchived()); - - accountsLogic.deleteAccountCascade(instructor5.getGoogleId()); - - // the archived instructor is also deleted - assertNull(instructorsLogic.getInstructorForEmail(instructor5.getCourseId(), instructor5.getEmail())); - // the course is also deleted - assertNull(coursesLogic.getCourse(instructor5.getCourseId())); - } - @Test public void testDeleteAccountCascade_nonExistentAccount_shouldPass() { InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); diff --git a/src/test/java/teammates/logic/core/FeedbackQuestionsLogicTest.java b/src/test/java/teammates/logic/core/FeedbackQuestionsLogicTest.java index 895507a9225..a24d9067ed9 100644 --- a/src/test/java/teammates/logic/core/FeedbackQuestionsLogicTest.java +++ b/src/test/java/teammates/logic/core/FeedbackQuestionsLogicTest.java @@ -576,7 +576,6 @@ public void testDeleteFeedbackQuestions_byCourseId_shouldDeleteQuestions() { assertEquals(0, questions.size()); // test that questions in other courses are unaffected - assertNotNull(getQuestionFromDatabase("qn1InSessionInArchivedCourse")); assertNotNull(getQuestionFromDatabase("qn1InSession4InCourse1")); } @@ -909,7 +908,7 @@ private void testHasFeedbackQuestionsForInstructor() { assertTrue(fqLogic.hasFeedbackQuestionsForInstructors(fsa, false)); ______TS("Valid session without questions for instructor should return false"); - fsa = fsLogic.getFeedbackSession("session without instructor questions", "idOfArchivedCourse"); + fsa = fsLogic.getFeedbackSession("session without instructor questions", "idOfNoQuestionsCourse"); assertFalse(fqLogic.hasFeedbackQuestionsForInstructors(fsa, false)); ______TS("Invalid session should not have questions"); @@ -981,7 +980,7 @@ private void testHasFeedbackQuestionsForStudents() { assertTrue(fqLogic.hasFeedbackQuestionsForStudents(fsa)); ______TS("Valid session without questions for students should return false"); - fsa = fsLogic.getFeedbackSession("session without student questions", "idOfArchivedCourse"); + fsa = fsLogic.getFeedbackSession("session without student questions", "idOfNoQuestionsCourse"); assertFalse(fqLogic.hasFeedbackQuestionsForStudents(fsa)); ______TS("Invalid session should not have questions"); diff --git a/src/test/java/teammates/logic/core/FeedbackSessionsLogicTest.java b/src/test/java/teammates/logic/core/FeedbackSessionsLogicTest.java index 05e5803a937..d96554c7875 100644 --- a/src/test/java/teammates/logic/core/FeedbackSessionsLogicTest.java +++ b/src/test/java/teammates/logic/core/FeedbackSessionsLogicTest.java @@ -508,7 +508,7 @@ private void testIsFeedbackSessionViewableToUserType() { assertTrue(fsLogic.isFeedbackSessionViewableToUserType(session, true)); ______TS("Session without questions for students, but with visible responses"); - session = dataBundle.feedbackSessions.get("archiveCourse.session1"); + session = dataBundle.feedbackSessions.get("sessionWithoutStudentQuestions"); assertTrue(fsLogic.isFeedbackSessionViewableToUserType(session, false)); session = dataBundle.feedbackSessions.get("session1InCourse2"); @@ -536,7 +536,7 @@ private void testIsFeedbackSessionForUserTypeToAnswer() { assertFalse(fsLogic.isFeedbackSessionForUserTypeToAnswer(session, true)); ______TS("Session without student question should not be for students to answer"); - session = dataBundle.feedbackSessions.get("archiveCourse.session1"); + session = dataBundle.feedbackSessions.get("sessionWithoutStudentQuestions"); assertFalse(fsLogic.isFeedbackSessionForUserTypeToAnswer(session, false)); assertTrue(fsLogic.isFeedbackSessionForUserTypeToAnswer(session, true)); diff --git a/src/test/java/teammates/logic/core/InstructorsLogicTest.java b/src/test/java/teammates/logic/core/InstructorsLogicTest.java index 0234faee667..70ef6ffe84d 100644 --- a/src/test/java/teammates/logic/core/InstructorsLogicTest.java +++ b/src/test/java/teammates/logic/core/InstructorsLogicTest.java @@ -643,23 +643,6 @@ public void testDeleteInstructors_byCourseId_shouldDeleteInstructorsAssociatedWi } - @Test - public void testDeleteInstructorsForGoogleIdCascade_archivedInstructor_shouldDeleteAlso() throws Exception { - InstructorAttributes instructor5 = dataBundle.instructors.get("instructor5"); - - assertNotNull(instructor5.getGoogleId()); - instructorsLogic.setArchiveStatusOfInstructor(instructor5.getGoogleId(), instructor5.getCourseId(), true); - - // this is an archived instructor - assertTrue( - instructorsLogic.getInstructorForEmail(instructor5.getCourseId(), instructor5.getEmail()).isArchived()); - - instructorsLogic.deleteInstructorsForGoogleIdCascade(instructor5.getGoogleId()); - - // the instructor should be deleted also - assertNull(instructorsLogic.getInstructorForEmail(instructor5.getCourseId(), instructor5.getEmail())); - } - @Test public void testDeleteInstructorsForGoogleIdCascade() throws Exception { @@ -774,7 +757,6 @@ private void testUpdateToEnsureValidityOfInstructorsForTheCourse() { Const.InstructorPermissions.CAN_MODIFY_INSTRUCTOR)); ______TS("The course has 1 registered instructor with modifying instructor privilege"); - courseId = "idOfArchivedCourse"; instructorsLogic.updateToEnsureValidityOfInstructorsForTheCourse(courseId, instructorToUpdate); assertFalse(instructorToUpdate.getPrivileges().isAllowedForPrivilege( diff --git a/src/test/java/teammates/logic/core/StudentsLogicTest.java b/src/test/java/teammates/logic/core/StudentsLogicTest.java index 0d03625d38e..b3b25b5eeb5 100644 --- a/src/test/java/teammates/logic/core/StudentsLogicTest.java +++ b/src/test/java/teammates/logic/core/StudentsLogicTest.java @@ -821,12 +821,12 @@ public void testDeleteStudentsInCourseCascade_typicalCase_shouldDoCascadeDeletio @Test public void testDeleteStudents_byCourseId_shouldDeleteAllStudents() { StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); - StudentAttributes student1InArchivedCourse = dataBundle.students.get("student1InArchivedCourse"); + StudentAttributes student1InCourse2 = dataBundle.students.get("student1InCourse2"); // the two are in different course - assertNotEquals(student1InCourse1.getCourse(), student1InArchivedCourse.getCourse()); + assertNotEquals(student1InCourse1.getCourse(), student1InCourse2.getCourse()); - assertNotNull(studentsLogic.getStudentForEmail(student1InArchivedCourse.getCourse(), - student1InArchivedCourse.getEmail())); + assertNotNull(studentsLogic.getStudentForEmail(student1InCourse2.getCourse(), + student1InCourse2.getEmail())); // there are students in the course assertFalse(studentsLogic.getStudentsForCourse(student1InCourse1.getCourse()).isEmpty()); @@ -838,8 +838,8 @@ public void testDeleteStudents_byCourseId_shouldDeleteAllStudents() { // students are deleted assertTrue(studentsLogic.getStudentsForCourse(student1InCourse1.getCourse()).isEmpty()); // students in other courses are not affected - assertNotNull(studentsLogic.getStudentForEmail(student1InArchivedCourse.getCourse(), - student1InArchivedCourse.getEmail())); + assertNotNull(studentsLogic.getStudentForEmail(student1InCourse2.getCourse(), + student1InCourse2.getEmail())); } @Test diff --git a/src/test/java/teammates/storage/api/InstructorsDbTest.java b/src/test/java/teammates/storage/api/InstructorsDbTest.java index e55ad77876d..61ce9bcf7a9 100644 --- a/src/test/java/teammates/storage/api/InstructorsDbTest.java +++ b/src/test/java/teammates/storage/api/InstructorsDbTest.java @@ -37,14 +37,6 @@ public void addInstructorsToDb() throws Exception { } } - private void setArchiveStatusOfInstructor(String googleId, String courseId, boolean archiveStatus) throws Exception { - instructorsDb.updateInstructorByGoogleId( - InstructorAttributes.updateOptionsWithGoogleIdBuilder(courseId, googleId) - .withIsArchived(archiveStatus) - .build() - ); - } - @Test public void testCreateInstructor() throws Exception { @@ -217,7 +209,7 @@ public void testGetInstructorsForGoogleId() throws Exception { String googleId = "idOfInstructor3"; - List retrieved = instructorsDb.getInstructorsForGoogleId(googleId, false); + List retrieved = instructorsDb.getInstructorsForGoogleId(googleId); assertEquals(2, retrieved.size()); InstructorAttributes instructor1 = retrieved.get(0); @@ -226,22 +218,15 @@ public void testGetInstructorsForGoogleId() throws Exception { assertEquals("idOfTypicalCourse1", instructor1.getCourseId()); assertEquals("idOfTypicalCourse2", instructor2.getCourseId()); - ______TS("Success: get instructors with specific googleId, with 1 archived course."); - - setArchiveStatusOfInstructor(googleId, instructor1.getCourseId(), true); - retrieved = instructorsDb.getInstructorsForGoogleId(googleId, true); - assertEquals(1, retrieved.size()); - setArchiveStatusOfInstructor(googleId, instructor1.getCourseId(), false); - ______TS("Failure: instructor does not exist"); - retrieved = instructorsDb.getInstructorsForGoogleId("non-exist-id", false); + retrieved = instructorsDb.getInstructorsForGoogleId("non-exist-id"); assertEquals(0, retrieved.size()); ______TS("Failure: null parameters"); assertThrows(AssertionError.class, - () -> instructorsDb.getInstructorsForGoogleId(null, false)); + () -> instructorsDb.getInstructorsForGoogleId(null)); } @@ -341,7 +326,6 @@ public void testUpdateInstructorByGoogleId() throws Exception { instructorToEdit.setName("New Name"); instructorToEdit.setEmail("InstrDbT.new-email@email.tmt"); - instructorToEdit.setArchived(true); instructorToEdit.setRole(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER); instructorToEdit.setDisplayedToStudents(false); instructorToEdit.setDisplayedName("New Displayed Name"); @@ -353,7 +337,6 @@ public void testUpdateInstructorByGoogleId() throws Exception { instructorToEdit.getGoogleId()) .withName(instructorToEdit.getName()) .withEmail(instructorToEdit.getEmail()) - .withIsArchived(instructorToEdit.isArchived()) .withRole(instructorToEdit.getRole()) .withIsDisplayedToStudents(instructorToEdit.isDisplayedToStudents()) .withDisplayedName(instructorToEdit.getDisplayedName()) @@ -366,8 +349,6 @@ public void testUpdateInstructorByGoogleId() throws Exception { assertEquals(instructorToEdit.getName(), updatedInstructor.getName()); assertEquals(instructorToEdit.getEmail(), actualInstructor.getEmail()); assertEquals(instructorToEdit.getEmail(), updatedInstructor.getEmail()); - assertTrue(actualInstructor.isArchived()); - assertTrue(updatedInstructor.isArchived()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER, actualInstructor.getRole()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER, updatedInstructor.getRole()); assertFalse(actualInstructor.isDisplayedToStudents()); @@ -441,7 +422,6 @@ public void testUpdateInstructorByGoogleId_noChangeToInstructor_shouldNotIssueSa instructorToEdit.getCourseId(), instructorToEdit.getGoogleId()) .withName(instructorToEdit.getName()) .withEmail(instructorToEdit.getEmail()) - .withIsArchived(instructorToEdit.isArchived()) .withRole(instructorToEdit.getRole()) .withIsDisplayedToStudents(instructorToEdit.isDisplayedToStudents()) .withDisplayedName(instructorToEdit.getDisplayedName()) @@ -481,16 +461,8 @@ public void testUpdateInstructorByGoogleId_singleFieldUpdate_shouldUpdateCorrect assertEquals("testName", updatedInstructor.getName()); assertEquals("testName", actualInstructor.getName()); - assertFalse(actualInstructor.isArchived()); - updatedInstructor = instructorsDb.updateInstructorByGoogleId( - InstructorAttributes - .updateOptionsWithGoogleIdBuilder(typicalInstructor.getCourseId(), typicalInstructor.getGoogleId()) - .withIsArchived(true) - .build()); actualInstructor = instructorsDb.getInstructorForGoogleId(typicalInstructor.getCourseId(), typicalInstructor.getGoogleId()); - assertTrue(updatedInstructor.isArchived()); - assertTrue(actualInstructor.isArchived()); assertNotEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_TUTOR, actualInstructor.getRole()); updatedInstructor = instructorsDb.updateInstructorByGoogleId( @@ -564,7 +536,6 @@ public void testUpdateInstructorByEmail_noChangeToInstructor_shouldNotIssueSaveR instructorToEdit.getCourseId(), instructorToEdit.getEmail()) .withName(instructorToEdit.getName()) .withGoogleId(instructorToEdit.getGoogleId()) - .withIsArchived(instructorToEdit.isArchived()) .withRole(instructorToEdit.getRole()) .withIsDisplayedToStudents(instructorToEdit.isDisplayedToStudents()) .withDisplayedName(instructorToEdit.getDisplayedName()) @@ -604,16 +575,8 @@ public void testUpdateInstructorByEmail_singleFieldUpdate_shouldUpdateCorrectly( assertEquals("testName", updatedInstructor.getName()); assertEquals("testName", actualInstructor.getName()); - assertFalse(actualInstructor.isArchived()); - updatedInstructor = instructorsDb.updateInstructorByEmail( - InstructorAttributes - .updateOptionsWithEmailBuilder(typicalInstructor.getCourseId(), typicalInstructor.getEmail()) - .withIsArchived(true) - .build()); actualInstructor = instructorsDb.getInstructorForEmail(typicalInstructor.getCourseId(), typicalInstructor.getEmail()); - assertTrue(updatedInstructor.isArchived()); - assertTrue(actualInstructor.isArchived()); assertNotEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_TUTOR, actualInstructor.getRole()); updatedInstructor = instructorsDb.updateInstructorByEmail( @@ -678,7 +641,6 @@ public void testUpdateInstructorByEmail() throws Exception { instructorToEdit.setGoogleId("new-id"); instructorToEdit.setName("New Name"); - instructorToEdit.setArchived(true); instructorToEdit.setRole(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER); instructorToEdit.setDisplayedToStudents(false); instructorToEdit.setDisplayedName("New Displayed Name"); @@ -690,7 +652,6 @@ public void testUpdateInstructorByEmail() throws Exception { instructorToEdit.getEmail()) .withGoogleId(instructorToEdit.getGoogleId()) .withName(instructorToEdit.getName()) - .withIsArchived(instructorToEdit.isArchived()) .withRole(instructorToEdit.getRole()) .withIsDisplayedToStudents(instructorToEdit.isDisplayedToStudents()) .withDisplayedName(instructorToEdit.getDisplayedName()) @@ -703,8 +664,6 @@ public void testUpdateInstructorByEmail() throws Exception { assertEquals("new-id", updatedInstructor.getGoogleId()); assertEquals("New Name", actualInstructor.getName()); assertEquals("New Name", updatedInstructor.getName()); - assertTrue(actualInstructor.isArchived()); - assertTrue(updatedInstructor.isArchived()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER, actualInstructor.getRole()); assertEquals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_OBSERVER, updatedInstructor.getRole()); assertFalse(actualInstructor.isDisplayedToStudents()); @@ -801,7 +760,7 @@ public void testDeleteInstructors_byCourseId_shouldDeleteInstructorsAssociatedWi ______TS("Success: delete instructors of a specific course"); - String courseId = "idOfArchivedCourse"; + String courseId = "idOfNoQuestionsCourse"; instructorsDb.deleteInstructors(AttributesDeletionQuery.builder() .withCourseId(courseId) .build()); diff --git a/src/test/java/teammates/storage/search/AccountRequestSearchTest.java b/src/test/java/teammates/storage/search/AccountRequestSearchTest.java index 1057995953a..d20694221b1 100644 --- a/src/test/java/teammates/storage/search/AccountRequestSearchTest.java +++ b/src/test/java/teammates/storage/search/AccountRequestSearchTest.java @@ -32,7 +32,7 @@ public void allTests() throws Exception { AccountRequestAttributes ins1InCourse3 = dataBundle.accountRequests.get("instructor1OfCourse3"); AccountRequestAttributes ins2InCourse3 = dataBundle.accountRequests.get("instructor2OfCourse3"); AccountRequestAttributes insInUnregCourse = dataBundle.accountRequests.get("instructor5"); - AccountRequestAttributes insOfArchivedCourse = dataBundle.accountRequests.get("instructorOfArchivedCourse"); + AccountRequestAttributes insInInstitute5 = dataBundle.accountRequests.get("instructor6"); AccountRequestAttributes unregisteredInstructor1 = dataBundle.accountRequests.get("unregisteredInstructor1"); AccountRequestAttributes unregisteredInstructor2 = @@ -72,7 +72,7 @@ public void allTests() throws Exception { ______TS("success: search for account requests; account requests should be searchable by their institute"); results = accountRequestsDb.searchAccountRequestsInWholeSystem("\"TEAMMATES Test Institute 5\""); - verifySearchResults(results, insOfArchivedCourse); + verifySearchResults(results, insInInstitute5); ______TS("success: search for account requests; unregistered account requests should be searchable"); diff --git a/src/test/java/teammates/storage/search/InstructorSearchTest.java b/src/test/java/teammates/storage/search/InstructorSearchTest.java index 76956730e94..fea064a2640 100644 --- a/src/test/java/teammates/storage/search/InstructorSearchTest.java +++ b/src/test/java/teammates/storage/search/InstructorSearchTest.java @@ -35,7 +35,6 @@ public void allTests() throws Exception { InstructorAttributes ins1InCourse3 = dataBundle.instructors.get("instructor1OfCourse3"); InstructorAttributes ins2InCourse3 = dataBundle.instructors.get("instructor2OfCourse3"); InstructorAttributes ins1InCourse4 = dataBundle.instructors.get("instructor1OfCourse4"); - InstructorAttributes insInArchivedCourse = dataBundle.instructors.get("instructorOfArchivedCourse"); InstructorAttributes insInUnregCourse = dataBundle.instructors.get("instructor5"); InstructorAttributes ins1InTestingSanitizationCourse = dataBundle.instructors.get("instructor1OfTestingSanitizationCourse"); @@ -63,11 +62,6 @@ public void allTests() throws Exception { results = instructorsDb.searchInstructorsInWholeSystem("InStRuCtOr2"); verifySearchResults(results, ins2InCourse1, ins2InCourse2, ins2InCourse3); - ______TS("success: search for instructors in whole system; instructors in archived courses should be included"); - - results = instructorsDb.searchInstructorsInWholeSystem("archived"); - verifySearchResults(results, insInArchivedCourse); - ______TS("success: search for instructors in whole system; instructors in unregistered course should be included"); results = instructorsDb.searchInstructorsInWholeSystem("instructor5"); diff --git a/src/test/java/teammates/storage/search/StudentSearchTest.java b/src/test/java/teammates/storage/search/StudentSearchTest.java index 2f8556ebb6e..c1e309a0052 100644 --- a/src/test/java/teammates/storage/search/StudentSearchTest.java +++ b/src/test/java/teammates/storage/search/StudentSearchTest.java @@ -35,7 +35,6 @@ public void allTests() throws Exception { StudentAttributes stu1InCourse3 = dataBundle.students.get("student1InCourse3"); StudentAttributes stu1InUnregCourse = dataBundle.students.get("student1InUnregisteredCourse"); StudentAttributes stu2InUnregCourse = dataBundle.students.get("student2InUnregisteredCourse"); - StudentAttributes stu1InArchCourse = dataBundle.students.get("student1InArchivedCourse"); ______TS("success: search for students in whole system; query string does not match any student"); @@ -48,9 +47,9 @@ public void allTests() throws Exception { studentList = studentsDb.searchStudentsInWholeSystem("student1"); - assertEquals(5, studentList.size()); + assertEquals(4, studentList.size()); AssertHelper.assertSameContentIgnoreOrder( - Arrays.asList(stu1InCourse1, stu1InCourse2, stu1InCourse3, stu1InUnregCourse, stu1InArchCourse), + Arrays.asList(stu1InCourse1, stu1InCourse2, stu1InCourse3, stu1InUnregCourse), studentList); ______TS("success: search for students in whole system; query string should be case-insensitive"); @@ -100,14 +99,13 @@ public void testSearchStudent_deleteAfterSearch_shouldNotBeSearchable() throws E StudentAttributes stu1InCourse2 = dataBundle.students.get("student1InCourse2"); StudentAttributes stu1InCourse3 = dataBundle.students.get("student1InCourse3"); StudentAttributes stu1InUnregCourse = dataBundle.students.get("student1InUnregisteredCourse"); - StudentAttributes stu1InArchCourse = dataBundle.students.get("student1InArchivedCourse"); List studentList = studentsDb.searchStudentsInWholeSystem("student1"); // there is search result before deletion - assertEquals(5, studentList.size()); + assertEquals(4, studentList.size()); AssertHelper.assertSameContentIgnoreOrder( - Arrays.asList(stu1InCourse1, stu1InCourse2, stu1InCourse3, stu1InUnregCourse, stu1InArchCourse), + Arrays.asList(stu1InCourse1, stu1InCourse2, stu1InCourse3, stu1InUnregCourse), studentList); // delete a student @@ -116,9 +114,9 @@ public void testSearchStudent_deleteAfterSearch_shouldNotBeSearchable() throws E // the search result will change studentList = studentsDb.searchStudentsInWholeSystem("student1"); - assertEquals(4, studentList.size()); + assertEquals(3, studentList.size()); AssertHelper.assertSameContentIgnoreOrder( - Arrays.asList(stu1InCourse2, stu1InCourse3, stu1InUnregCourse, stu1InArchCourse), + Arrays.asList(stu1InCourse2, stu1InCourse3, stu1InUnregCourse), studentList); // delete all students in course 2 @@ -129,9 +127,9 @@ public void testSearchStudent_deleteAfterSearch_shouldNotBeSearchable() throws E // the search result will change studentList = studentsDb.searchStudentsInWholeSystem("student1"); - assertEquals(3, studentList.size()); + assertEquals(2, studentList.size()); AssertHelper.assertSameContentIgnoreOrder( - Arrays.asList(stu1InCourse3, stu1InUnregCourse, stu1InArchCourse), + Arrays.asList(stu1InCourse3, stu1InUnregCourse), studentList); } diff --git a/src/test/java/teammates/test/AbstractBackDoor.java b/src/test/java/teammates/test/AbstractBackDoor.java index 2a05cc92ea9..d6063ce9e68 100644 --- a/src/test/java/teammates/test/AbstractBackDoor.java +++ b/src/test/java/teammates/test/AbstractBackDoor.java @@ -49,7 +49,6 @@ import teammates.ui.output.AccountData; import teammates.ui.output.AccountRequestData; import teammates.ui.output.CourseData; -import teammates.ui.output.CoursesData; import teammates.ui.output.DeadlineExtensionData; import teammates.ui.output.FeedbackQuestionData; import teammates.ui.output.FeedbackQuestionsData; @@ -354,50 +353,6 @@ public CourseAttributes getCourse(String courseId) { .build(); } - /** - * Gets archived course data from the database. - */ - public CourseData getArchivedCourseData(String instructorId, String courseId) { - Map params = new HashMap<>(); - params.put(Const.ParamsNames.USER_ID, instructorId); - params.put(Const.ParamsNames.COURSE_ID, courseId); - params.put(Const.ParamsNames.ENTITY_TYPE, Const.EntityType.INSTRUCTOR); - params.put(Const.ParamsNames.COURSE_STATUS, Const.CourseStatus.ARCHIVED); - - ResponseBodyAndCode response = executeGetRequest(Const.ResourceURIs.COURSES, params); - if (response.responseCode == HttpStatus.SC_NOT_FOUND) { - return null; - } - - CoursesData coursesData = JsonUtils.fromJson(response.responseBody, CoursesData.class); - CourseData courseData = coursesData.getCourses() - .stream() - .filter(cd -> cd.getCourseId().equals(courseId)) - .findFirst() - .orElse(null); - - if (courseData == null) { - return null; - } - - return courseData; - } - - /** - * Gets a archived course from the database. - */ - public CourseAttributes getArchivedCourse(String instructorId, String courseId) { - CourseData courseData = getArchivedCourseData(instructorId, courseId); - if (courseData == null) { - return null; - } - return CourseAttributes.builder(courseData.getCourseId()) - .withName(courseData.getCourseName()) - .withTimezone(courseData.getTimeZone()) - .withInstitute(courseData.getInstitute()) - .build(); - } - /** * Returns true if the course exists and is in recycle bin. */ diff --git a/src/test/java/teammates/ui/webapi/ArchiveCourseActionTest.java b/src/test/java/teammates/ui/webapi/ArchiveCourseActionTest.java deleted file mode 100644 index e0daff035d3..00000000000 --- a/src/test/java/teammates/ui/webapi/ArchiveCourseActionTest.java +++ /dev/null @@ -1,129 +0,0 @@ -package teammates.ui.webapi; - -import org.testng.annotations.Test; - -import teammates.common.datatransfer.attributes.InstructorAttributes; -import teammates.common.util.Const; -import teammates.ui.output.CourseArchiveData; -import teammates.ui.request.CourseArchiveRequest; - -/** - * SUT: {@link ArchiveCourseAction}. - */ -public class ArchiveCourseActionTest extends BaseActionTest { - - @Override - protected String getActionUri() { - return Const.ResourceURIs.COURSE_ARCHIVE; - } - - @Override - protected String getRequestMethod() { - return PUT; - } - - @Override - @Test - protected void testExecute() { - InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); - String instructorId = instructor1OfCourse1.getGoogleId(); - - loginAsInstructor(instructorId); - - String[] submissionParams = new String[] { - Const.ParamsNames.COURSE_ID, instructor1OfCourse1.getCourseId(), - }; - - CourseArchiveRequest courseArchiveRequest = new CourseArchiveRequest(); - courseArchiveRequest.setArchiveStatus(true); - - ______TS("Not enough parameters"); - verifyHttpParameterFailure(); - verifyHttpRequestBodyFailure(null, submissionParams); - verifyHttpParameterFailure(courseArchiveRequest); - - ______TS("Typical case: archive a course"); - - ArchiveCourseAction archiveCourseAction = getAction(courseArchiveRequest, submissionParams); - JsonResult result = getJsonResult(archiveCourseAction); - CourseArchiveData courseArchiveData = (CourseArchiveData) result.getOutput(); - - InstructorAttributes theInstructor = logic.getInstructorForGoogleId( - instructor1OfCourse1.getCourseId(), instructor1OfCourse1.getGoogleId()); - - assertTrue(theInstructor.isArchived()); - verifyCourseArchive(courseArchiveData, instructor1OfCourse1.getCourseId(), true); - - ______TS("Rare case: archive an already archived course"); - - courseArchiveRequest.setArchiveStatus(true); - - archiveCourseAction = getAction(courseArchiveRequest, submissionParams); - result = getJsonResult(archiveCourseAction); - courseArchiveData = (CourseArchiveData) result.getOutput(); - - theInstructor = logic.getInstructorForGoogleId( - instructor1OfCourse1.getCourseId(), instructor1OfCourse1.getGoogleId()); - - assertTrue(theInstructor.isArchived()); - verifyCourseArchive(courseArchiveData, instructor1OfCourse1.getCourseId(), true); - - ______TS("Typical case: unarchive a course"); - - courseArchiveRequest.setArchiveStatus(false); - - ArchiveCourseAction unarchiveAction = getAction(courseArchiveRequest, submissionParams); - result = getJsonResult(unarchiveAction); - courseArchiveData = (CourseArchiveData) result.getOutput(); - - theInstructor = logic.getInstructorForGoogleId(instructor1OfCourse1.getCourseId(), - instructor1OfCourse1.getGoogleId()); - - assertFalse(theInstructor.isArchived()); - verifyCourseArchive(courseArchiveData, instructor1OfCourse1.getCourseId(), false); - - ______TS("Rare case: unarchive an active course"); - - courseArchiveRequest.setArchiveStatus(false); - - unarchiveAction = getAction(courseArchiveRequest, submissionParams); - result = getJsonResult(unarchiveAction); - courseArchiveData = (CourseArchiveData) result.getOutput(); - - theInstructor = logic.getInstructorForGoogleId( - instructor1OfCourse1.getCourseId(), instructor1OfCourse1.getGoogleId()); - - assertFalse(theInstructor.isArchived()); - verifyCourseArchive(courseArchiveData, instructor1OfCourse1.getCourseId(), false); - - ______TS("Masquerade mode: archive course"); - - loginAsAdmin(); - courseArchiveRequest.setArchiveStatus(true); - - archiveCourseAction = getAction(courseArchiveRequest, addUserIdToParams(instructorId, submissionParams)); - result = getJsonResult(archiveCourseAction); - courseArchiveData = (CourseArchiveData) result.getOutput(); - - theInstructor = logic.getInstructorForGoogleId( - instructor1OfCourse1.getCourseId(), instructor1OfCourse1.getGoogleId()); - - assertTrue(theInstructor.isArchived()); - verifyCourseArchive(courseArchiveData, instructor1OfCourse1.getCourseId(), true); - } - - private void verifyCourseArchive(CourseArchiveData courseArchiveData, String courseId, boolean isArchived) { - assertEquals(courseArchiveData.getCourseId(), courseId); - assertEquals(courseArchiveData.getIsArchived(), isArchived); - } - - @Override - @Test - protected void testAccessControl() { - String[] submissionParams = new String[] { - Const.ParamsNames.COURSE_ID, typicalBundle.instructors.get("instructor1OfCourse1").getCourseId(), - }; - - verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); - } -} diff --git a/src/test/java/teammates/ui/webapi/BinCourseActionTest.java b/src/test/java/teammates/ui/webapi/BinCourseActionTest.java index b2317123258..f29aedfe89b 100644 --- a/src/test/java/teammates/ui/webapi/BinCourseActionTest.java +++ b/src/test/java/teammates/ui/webapi/BinCourseActionTest.java @@ -58,7 +58,7 @@ protected void testExecute() throws Exception { verifyCourseData(courseData, courseToBeDeleted.getId(), courseToBeDeleted.getName(), courseToBeDeleted.getTimeZone()); - List instructors = logic.getInstructorsForGoogleId(instructorId, false); + List instructors = logic.getInstructorsForGoogleId(instructorId); List courseList = logic.getCoursesForInstructor(instructors); assertEquals(1, courseList.size()); assertEquals("icdct.tpa.id1", courseList.get(0).getId()); diff --git a/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java b/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java index 901ec6497d2..9f93cc2c667 100644 --- a/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java +++ b/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java @@ -57,7 +57,6 @@ protected void testExecute() { CreateInstructorAction.class, GetInstructorAction.class, UpdateInstructorAction.class, - ArchiveCourseAction.class, InstructorCourseJoinEmailWorkerAction.class, DeleteStudentAction.class, GetStudentAction.class, diff --git a/src/test/java/teammates/ui/webapi/GetCoursesActionTest.java b/src/test/java/teammates/ui/webapi/GetCoursesActionTest.java index 4a756cf4e7f..84d6f14bdf7 100644 --- a/src/test/java/teammates/ui/webapi/GetCoursesActionTest.java +++ b/src/test/java/teammates/ui/webapi/GetCoursesActionTest.java @@ -84,27 +84,13 @@ public void testGetCoursesAction_withInstructorEntityTypeAndActiveCourses_should loginAsInstructor(instructor.getGoogleId()); CoursesData courses = getValidCourses(params); - assertEquals(2, courses.getCourses().size()); + assertEquals(3, courses.getCourses().size()); CourseAttributes expectedCourse1 = testData.courses.get("typicalCourse1"); CourseAttributes expectedCourse2 = testData.courses.get("typicalCourse2"); + CourseAttributes expectedCourse3 = testData.courses.get("typicalCourse4"); verifySameCourseData(courses.getCourses().get(0), expectedCourse1); verifySameCourseData(courses.getCourses().get(1), expectedCourse2); - } - - @Test - public void testGetCoursesAction_withInstructorEntityTypeAndArchivedCourses_shouldReturnCorrectCourses() { - String[] params = { - Const.ParamsNames.ENTITY_TYPE, Const.EntityType.INSTRUCTOR, - Const.ParamsNames.COURSE_STATUS, Const.CourseStatus.ARCHIVED, - }; - - InstructorAttributes instructor = testData.instructors.get("instructor1OfCourse1"); - loginAsInstructor(instructor.getGoogleId()); - - CoursesData courses = getValidCourses(params); - assertEquals(1, courses.getCourses().size()); - CourseAttributes expectedCourse = testData.courses.get("typicalCourse4"); - verifySameCourseData(courses.getCourses().get(0), expectedCourse); + verifySameCourseData(courses.getCourses().get(2), expectedCourse3); } @Test @@ -132,14 +118,12 @@ public void testGetCoursesAction_withStudentEntityType_shouldReturnCorrectCourse loginAsStudent(student.getGoogleId()); CoursesData courses = getValidCourses(params); - assertEquals(3, courses.getCourses().size()); + assertEquals(2, courses.getCourses().size()); CourseAttributes expectedCourse1 = testData.courses.get("typicalCourse1"); CourseAttributes expectedCourse2 = testData.courses.get("typicalCourse2"); - CourseAttributes expectedCourse3 = testData.courses.get("typicalCourse4"); verifySameCourseDataStudent(courses.getCourses().get(0), expectedCourse1); verifySameCourseDataStudent(courses.getCourses().get(1), expectedCourse2); - verifySameCourseDataStudent(courses.getCourses().get(2), expectedCourse3); } private void verifySameCourseData(CourseData actualCourse, CourseAttributes expectedCourse) { diff --git a/src/test/java/teammates/ui/webapi/SearchStudentsActionTest.java b/src/test/java/teammates/ui/webapi/SearchStudentsActionTest.java index b68ed207e9b..e5d9677ccb9 100644 --- a/src/test/java/teammates/ui/webapi/SearchStudentsActionTest.java +++ b/src/test/java/teammates/ui/webapi/SearchStudentsActionTest.java @@ -84,7 +84,7 @@ public void execute_adminSearchName_success() { SearchStudentsAction a = getAction(accNameParams); JsonResult result = getJsonResult(a); StudentsData response = (StudentsData) result.getOutput(); - assertEquals(11, response.getStudents().size()); + assertEquals(10, response.getStudents().size()); } @Test @@ -176,7 +176,7 @@ public void execute_adminSearchGoogleId_success() { JsonResult result = getJsonResult(a); StudentsData response = (StudentsData) result.getOutput(); - assertEquals(11, response.getStudents().size()); + assertEquals(10, response.getStudents().size()); } @Test diff --git a/src/test/resources/data/CourseRosterDataBundle.json b/src/test/resources/data/CourseRosterDataBundle.json index 7a6b7fcf2e8..196d97b3b29 100644 --- a/src/test/resources/data/CourseRosterDataBundle.json +++ b/src/test/resources/data/CourseRosterDataBundle.json @@ -5,7 +5,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -29,7 +28,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -53,7 +51,6 @@ "courseId": "idOfTypicalCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", @@ -77,7 +74,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor1 Course2", "email": "instructor1@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -101,7 +97,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor2 Course2", "email": "instructor2@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -125,7 +120,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor1 Course3", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -149,7 +143,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor2 Course3", "email": "instructor2@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -173,7 +166,6 @@ "courseId": "idOfTypicalCourse4", "name": "Instructor1 Course4", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -197,7 +189,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -221,7 +212,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor3 Course2", "email": "instructor3@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -245,7 +235,6 @@ "courseId": "idOfCourseNoEvals", "name": "Instructor4 name", "email": "instructor4@courseNoEvals.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -269,7 +258,6 @@ "courseId": "idOfUnregisteredCourse", "name": "Instructor 5 of CourseNoRegister", "email": "instructor5@courseNoRegister.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -293,7 +281,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name1", "email": "instructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -317,7 +304,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name2", "email": "secondInstructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Instructor", @@ -341,7 +327,6 @@ "name": "Instructor Not Yet Joined Course", "email": "instructorNotYetJoined@email.tmt", "key": "regKeyForInstrNotYetJoinCourse", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -365,7 +350,6 @@ "courseId": "idOfTestingSanitizationCourse", "name": "Instructor", "email": "instructor1@sanitization.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "inst'\"/>", @@ -487,15 +471,6 @@ "section": "Section 2", "key": "regKey2ForStuNotYetJoinCourse" }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "email": "student1InArchivedCourse@gmail.tmt", - "course": "idOfArchivedCourse", - "name": "student1 In Course1", - "comments": "", - "team": "Team 2.1", - "section": "None" - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "email": "normal@sanitization.tmt", diff --git a/src/test/resources/data/EmailGeneratorTest.json b/src/test/resources/data/EmailGeneratorTest.json index 895c5874927..f259d57684c 100644 --- a/src/test/resources/data/EmailGeneratorTest.json +++ b/src/test/resources/data/EmailGeneratorTest.json @@ -118,7 +118,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -142,7 +141,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -166,7 +164,6 @@ "courseId": "idOfTypicalCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", @@ -189,7 +186,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor Not Yet Joined Course 1", "email": "instructorNotYetJoinedCourse1@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -213,7 +209,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor1 Course2", "email": "instructor1@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -237,7 +232,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -261,7 +255,6 @@ "courseId": "idOfTestingNoEmailsSentCourse", "name": "Instructor1 No Emails Sent Course", "email": "instructor1@noemailssent.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -285,7 +278,6 @@ "courseId": "idOfTestingSanitizationCourse", "name": "Instructor", "email": "instructor1@sanitization.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "inst'\"/>", diff --git a/src/test/resources/data/FeedbackContributionQuestionTest.json b/src/test/resources/data/FeedbackContributionQuestionTest.json index 0acdd1b6bc9..ec870620d87 100644 --- a/src/test/resources/data/FeedbackContributionQuestionTest.json +++ b/src/test/resources/data/FeedbackContributionQuestionTest.json @@ -72,12 +72,6 @@ "email": "iwosc@yahoo.tmt", "readNotifications": {} }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "readNotifications": {} - }, "instructor1OfTestingSanitizationCourse": { "googleId": "idOfInstructor1OfTestingSanitizationCourse", "name": "Instructor", @@ -96,12 +90,6 @@ "email": "student2InCourse1@gmail.tmt", "readNotifications": {} }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "name": "Student in Archived Course", - "email": "student1InCourse1@gmail.tmt", - "readNotifications": {} - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "name": "Stud1", @@ -151,12 +139,6 @@ "institute": "TEAMMATES Test Institute 7", "timeZone": "Africa/Johannesburg" }, - "archivedCourse": { - "id": "idOfArchivedCourse", - "name": "Archived Course", - "institute": "TEAMMATES Test Institute 5", - "timeZone": "Africa/Johannesburg" - }, "unregisteredCourse": { "id": "idOfUnregisteredCourse", "name": "Unregistered Course", @@ -184,7 +166,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -208,7 +189,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -232,7 +212,6 @@ "courseId": "idOfTypicalCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", @@ -255,7 +234,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor Not Yet Joined Course 1", "email": "instructorNotYetJoinedCourse1@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -279,7 +257,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor1 Course2", "email": "instructor1@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -303,7 +280,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor2 Course2", "email": "instructor2@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -327,7 +303,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor1 Course3", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -351,7 +326,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor2 Course3", "email": "instructor2@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -375,7 +349,6 @@ "courseId": "idOfTypicalCourse4", "name": "Instructor1 Course4", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -399,7 +372,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -423,7 +395,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor3 Course2", "email": "instructor3@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -447,7 +418,6 @@ "courseId": "idOfCourseNoEvals", "name": "Instructor4 name", "email": "instructor4@courseNoEvals.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -471,7 +441,6 @@ "courseId": "idOfUnregisteredCourse", "name": "Instructor 5 of CourseNoRegister", "email": "instructor5@courseNoRegister.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -495,31 +464,6 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor With Only One Sample Course", "email": "iwosc@yahoo.tmt", - "isArchived": false, - "role": "Co-owner", - "isDisplayedToStudents": true, - "displayedName": "Instructor", - "privileges": { - "courseLevel": { - "canViewStudentInSections": true, - "canSubmitSessionInSections": true, - "canModifySessionCommentsInSections": true, - "canModifyCourse": true, - "canViewSessionInSections": true, - "canModifySession": true, - "canModifyStudent": true, - "canModifyInstructor": true - }, - "sectionLevel": {}, - "sessionLevel": {} - } - }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "courseId": "idOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -543,7 +487,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name1", "email": "instructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -567,7 +510,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name2", "email": "secondInstructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Instructor", @@ -590,7 +532,6 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor Not Yet Joined Course", "email": "instructorNotYetJoined@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -614,7 +555,6 @@ "courseId": "idOfTestingSanitizationCourse", "name": "Instructor", "email": "instructor1@sanitization.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "inst'\"/>", @@ -847,29 +787,6 @@ "studentDeadlines": {}, "instructorDeadlines": {} }, - "archiveCourse.session1": { - "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", - "creatorEmail": "instructor1@course1.tmt", - "instructions": "Please please fill in the following questions.", - "createdTime": "2013-01-20T23:00:00Z", - "startTime": "2013-02-20T23:00:00Z", - "endTime": "2026-04-28T23:00:00Z", - "sessionVisibleFromTime": "2013-02-20T23:00:00Z", - "resultsVisibleFromTime": "2026-04-29T23:00:00Z", - "timeZone": "Africa/Johannesburg", - "gracePeriod": 5, - "sentOpeningSoonEmail": true, - "sentOpenEmail": true, - "sentClosingEmail": false, - "sentClosedEmail": false, - "sentPublishedEmail": false, - "isOpeningEmailEnabled": true, - "isClosingEmailEnabled": true, - "isPublishedEmailEnabled": true, - "studentDeadlines": {}, - "instructorDeadlines": {} - }, "session1InCourse2": { "feedbackSessionName": "Instructor feedback session", "courseId": "idOfTypicalCourse2", diff --git a/src/test/resources/data/FeedbackResponseCommentCRUDTest.json b/src/test/resources/data/FeedbackResponseCommentCRUDTest.json index dcfff940819..c67bbefd3a0 100644 --- a/src/test/resources/data/FeedbackResponseCommentCRUDTest.json +++ b/src/test/resources/data/FeedbackResponseCommentCRUDTest.json @@ -115,7 +115,6 @@ "courseId": "idOfCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", diff --git a/src/test/resources/data/FeedbackResponseVisibilityTest.json b/src/test/resources/data/FeedbackResponseVisibilityTest.json index cd6b277d5b7..d9841547bf0 100644 --- a/src/test/resources/data/FeedbackResponseVisibilityTest.json +++ b/src/test/resources/data/FeedbackResponseVisibilityTest.json @@ -15,7 +15,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "FRV.instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -39,7 +38,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "FRV.instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -63,7 +61,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "FRV.instructor3@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -87,7 +84,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor4 Course1", "email": "FRV.instructor4@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -124,7 +120,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor5 Course1", "email": "FRV.instructor5@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -155,7 +150,6 @@ "courseId": "FRV.idOfTypicalCourse1", "name": "Instructor6 Course1", "email": "FRV.instructor6@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", diff --git a/src/test/resources/data/FeedbackSessionResultsBundleTest.json b/src/test/resources/data/FeedbackSessionResultsBundleTest.json index babb2e8f003..0483a4e0095 100644 --- a/src/test/resources/data/FeedbackSessionResultsBundleTest.json +++ b/src/test/resources/data/FeedbackSessionResultsBundleTest.json @@ -40,7 +40,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", diff --git a/src/test/resources/data/FeedbackSessionResultsTest.json b/src/test/resources/data/FeedbackSessionResultsTest.json index 41f22316367..55aa87627c8 100644 --- a/src/test/resources/data/FeedbackSessionResultsTest.json +++ b/src/test/resources/data/FeedbackSessionResultsTest.json @@ -75,7 +75,6 @@ "courseId": "FSRTest.idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "FSRTest.instr1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Co-owner", @@ -99,7 +98,6 @@ "courseId": "FSRTest.idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "FSRTest.instr2@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Co-owner", @@ -123,7 +121,6 @@ "courseId": "FSRTest.idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "FSRTest.instr3@course1n2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Co-owner", @@ -147,7 +144,6 @@ "courseId": "FSRTest.idOfNoSessionsCourse", "name": "Instructor3 No Sessions", "email": "FSRTest.instr3@course1n2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Co-owner", diff --git a/src/test/resources/data/FeedbackSessionsLogicTest.json b/src/test/resources/data/FeedbackSessionsLogicTest.json index 81d44e9a94f..0dff1b6de85 100644 --- a/src/test/resources/data/FeedbackSessionsLogicTest.json +++ b/src/test/resources/data/FeedbackSessionsLogicTest.json @@ -66,10 +66,10 @@ "email": "iwosc@yahoo.tmt", "readNotifications": {} }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", + "instructorOfNoQuestionsCourse": { + "googleId": "idOfInstructorOfNoQuestionsCourse", + "name": "InstructorOfNoQuestionsCourse name", + "email": "instructorOfNoQuestionsCourse@noQuestionsCourse.tmt", "readNotifications": {} }, "student1InCourse1": { @@ -84,9 +84,9 @@ "email": "student2InCourse1@gmail.tmt", "readNotifications": {} }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "name": "Student in Archived Course", + "student1InNoQuestionsCourse": { + "googleId": "student1InNoQuestionsCourse", + "name": "Student in No Questions Course", "email": "student1InCourse1@gmail.tmt", "readNotifications": {} } @@ -125,17 +125,17 @@ "institute": "TEAMMATES Test Institute 7", "timeZone": "UTC" }, - "archivedCourse": { - "id": "idOfArchivedCourse", - "name": "Archived Course", - "institute": "TEAMMATES Test Institute 5", - "timeZone": "UTC" - }, "unregisteredCourse": { "id": "idOfUnregisteredCourse", "name": "Unregistered Course", "institute": "TEAMMATES Test Institute 1", "timeZone": "UTC" + }, + "noQuestionsCourse": { + "id": "idOfNoQuestionsCourse", + "name": "No Questions Course", + "institute": "TEAMMATES Test Institute 5", + "timeZone": "UTC" } }, "instructors": { @@ -190,7 +190,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -351,7 +350,6 @@ "courseId": "idOfCourseNoEvals", "name": "Instructor4 name", "email": "instructor4@courseNoEvals.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -416,12 +414,11 @@ "sessionLevel": {} } }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "courseId": "idOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "isArchived": true, + "instructorOfNoQuestionsCourse": { + "googleId": "idOfInstructorOfNoQuestionsCourse", + "courseId": "idOfNoQuestionsCourse", + "name": "InstructorOfNoQuestionsCourse name", + "email": "instructorOfNoQuestionsCourse@noQuestionsCourse.tmt", "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -563,10 +560,10 @@ "team": "Team 2", "section": "Section 2" }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "email": "student1InArchivedCourse@gmail.tmt", - "course": "idOfArchivedCourse", + "student1InNoQuestionsCourse": { + "googleId": "student1InNoQuestionsCourse", + "email": "student1InNoQuestionsCourse@gmail.tmt", + "course": "idOfNoQuestionsCourse", "name": "student1 In Course1", "comments": "", "team": "Team 2.1", @@ -720,9 +717,9 @@ "studentDeadlines": {}, "instructorDeadlines": {} }, - "archiveCourse.session1": { + "sessionWithoutStudentQuestions": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "creatorEmail": "instructor1@course1.tmt", "instructions": "Please please fill in the following questions.", "createdTime": "2013-01-20T23:00:00Z", @@ -1090,27 +1087,6 @@ "RECEIVER" ] }, - "qn1InSessionInArchivedCourse": { - "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", - "questionDetails": { - "questionType": "TEXT", - "questionText": "Give feedback to students" - }, - "questionNumber": 1, - "giverType": "INSTRUCTORS", - "recipientType": "STUDENTS", - "numberOfEntitiesToGiveFeedbackTo": 4, - "showResponsesTo": [ - "RECEIVER" - ], - "showGiverNameTo": [ - "RECEIVER" - ], - "showRecipientNameTo": [ - "RECEIVER" - ] - }, "qn1InSession1InCourse2": { "feedbackSessionName": "Instructor feedback session", "courseId": "idOfTypicalCourse2", @@ -1142,6 +1118,27 @@ "showResponsesTo": [], "showGiverNameTo": [], "showRecipientNameTo": [] + }, + "qn1InSessionInNoQuestionsCourse": { + "feedbackSessionName": "session without student questions", + "courseId": "idOfNoQuestionsCourse", + "questionDetails": { + "questionType": "TEXT", + "questionText": "Give feedback to students" + }, + "questionNumber": 1, + "giverType": "INSTRUCTORS", + "recipientType": "STUDENTS", + "numberOfEntitiesToGiveFeedbackTo": 4, + "showResponsesTo": [ + "RECEIVER" + ], + "showGiverNameTo": [ + "RECEIVER" + ], + "showRecipientNameTo": [ + "RECEIVER" + ] } }, "feedbackResponses": { @@ -1368,10 +1365,10 @@ }, "response1ForNVSQ1": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "feedbackQuestionId": "1", - "giver": "instructorOfArchiveCourse@archiveCourse.tmt", - "recipient": "student1InArchivedCourse@gmail.tmt", + "giver": "instructorOfNoQuestionsCourse@noQuestionsCourse.tmt", + "recipient": "student1InNoQuestionsCourse@gmail.tmt", "giverSection": "None", "recipientSection": "Section 1", "responseDetails": { diff --git a/src/test/resources/data/GetCoursesActionTest.json b/src/test/resources/data/GetCoursesActionTest.json index feac1ef60ed..738c5531104 100644 --- a/src/test/resources/data/GetCoursesActionTest.json +++ b/src/test/resources/data/GetCoursesActionTest.json @@ -58,7 +58,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor 1", "email": "instr1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -82,7 +81,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor 1", "email": "instr1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -106,7 +104,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor 1", "email": "instr1@course1.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -130,7 +127,6 @@ "courseId": "idOfTypicalCourse4", "name": "Instructor 1", "email": "instr1@course1.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -154,7 +150,6 @@ "courseId": "idOfTypicalCourse5", "name": "Instructor 1", "email": "instr1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -201,15 +196,6 @@ "comments": "comment for student1InCourse3", "team": "Team 1.1", "section": "Section 1" - }, - "student1InArchivedCourse": { - "googleId": "idOfStudent1", - "email": "student1@gmail.tmt", - "course": "idOfTypicalCourse4", - "name": "student 1", - "comments": "", - "team": "Team 2.1", - "section": "None" } } } diff --git a/src/test/resources/data/GetFeedbackQuestionRecipientsActionTest.json b/src/test/resources/data/GetFeedbackQuestionRecipientsActionTest.json index b3ff78f1d29..a4ce509402f 100644 --- a/src/test/resources/data/GetFeedbackQuestionRecipientsActionTest.json +++ b/src/test/resources/data/GetFeedbackQuestionRecipientsActionTest.json @@ -72,12 +72,6 @@ "email": "iwosc@yahoo.tmt", "readNotifications": {} }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "readNotifications": {} - }, "instructor1OfTestingSanitizationCourse": { "googleId": "idOfInstructor1OfTestingSanitizationCourse", "name": "Instructor", @@ -96,12 +90,6 @@ "email": "student2InCourse1@gmail.tmt", "readNotifications": {} }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "name": "Student in Archived Course", - "email": "student1InCourse1@gmail.tmt", - "readNotifications": {} - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "name": "Stud1", @@ -151,12 +139,6 @@ "institute": "TEAMMATES Test Institute 7", "timeZone": "Africa/Johannesburg" }, - "archivedCourse": { - "id": "idOfArchivedCourse", - "name": "Archived Course", - "institute": "TEAMMATES Test Institute 5", - "timeZone": "Africa/Johannesburg" - }, "unregisteredCourse": { "id": "idOfUnregisteredCourse", "name": "Unregistered Course", @@ -177,7 +159,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -201,7 +182,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -225,7 +205,6 @@ "courseId": "idOfTypicalCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", @@ -248,7 +227,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor Not Yet Joined Course 1", "email": "instructorNotYetJoinedCourse1@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -272,7 +250,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor1 Course2", "email": "instructor1@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -296,7 +273,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor2 Course2", "email": "instructor2@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -320,7 +296,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor1 Course3", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -344,7 +319,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor2 Course3", "email": "instructor2@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -368,7 +342,6 @@ "courseId": "idOfTypicalCourse4", "name": "Instructor1 Course4", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -392,7 +365,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -416,7 +388,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor3 Course2", "email": "instructor3@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -440,7 +411,6 @@ "courseId": "idOfCourseNoEvals", "name": "Instructor4 name", "email": "instructor4@courseNoEvals.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -464,7 +434,6 @@ "courseId": "idOfUnregisteredCourse", "name": "Instructor 5 of CourseNoRegister", "email": "instructor5@courseNoRegister.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -488,31 +457,6 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor With Only One Sample Course", "email": "iwosc@yahoo.tmt", - "isArchived": false, - "role": "Co-owner", - "isDisplayedToStudents": true, - "displayedName": "Instructor", - "privileges": { - "courseLevel": { - "canViewStudentInSections": true, - "canSubmitSessionInSections": true, - "canModifySessionCommentsInSections": true, - "canModifyCourse": true, - "canViewSessionInSections": true, - "canModifySession": true, - "canModifyStudent": true, - "canModifyInstructor": true - }, - "sectionLevel": {}, - "sessionLevel": {} - } - }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "courseId": "idOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -535,7 +479,6 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor Not Yet Joined Course", "email": "instructorNotYetJoined@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -559,7 +502,6 @@ "courseId": "idOfTestingSanitizationCourse", "name": "Instructor", "email": "instructor1@sanitization.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "inst'\"/>", @@ -670,15 +612,6 @@ "team": "Team 2", "section": "Section 2" }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "email": "student1InArchivedCourse@gmail.tmt", - "course": "idOfArchivedCourse", - "name": "student1 In Course1", - "comments": "", - "team": "Team 2.1", - "section": "None" - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "email": "normal@sanitization.tmt", @@ -828,9 +761,9 @@ "studentDeadlines": {}, "instructorDeadlines": {} }, - "archiveCourse.session1": { + "sessionWithoutStudentQuestions": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "creatorEmail": "instructor1@course1.tmt", "instructions": "Please please fill in the following questions.", "createdTime": "2013-01-20T23:00:00Z", @@ -1316,27 +1249,6 @@ "RECEIVER" ] }, - "qn1InSessionInArchivedCourse": { - "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", - "questionDetails": { - "questionType": "TEXT", - "questionText": "Give feedback to students" - }, - "questionNumber": 1, - "giverType": "INSTRUCTORS", - "recipientType": "STUDENTS", - "numberOfEntitiesToGiveFeedbackTo": 4, - "showResponsesTo": [ - "RECEIVER" - ], - "showGiverNameTo": [ - "RECEIVER" - ], - "showRecipientNameTo": [ - "RECEIVER" - ] - }, "qn1InSession1InCourse2": { "feedbackSessionName": "Instructor feedback session", "courseId": "idOfTypicalCourse2", diff --git a/src/test/resources/data/typicalDataBundle.json b/src/test/resources/data/typicalDataBundle.json index 5d2924bc506..0e8fa8e314c 100644 --- a/src/test/resources/data/typicalDataBundle.json +++ b/src/test/resources/data/typicalDataBundle.json @@ -77,12 +77,6 @@ "email": "iwosc@yahoo.tmt", "readNotifications": {} }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "readNotifications": {} - }, "instructor1OfTestingSanitizationCourse": { "googleId": "idOfInstructor1OfTestingSanitizationCourse", "name": "Instructor", @@ -101,12 +95,6 @@ "email": "student2InCourse1@gmail.tmt", "readNotifications": {} }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "name": "Student in Archived Course", - "email": "student1InCourse1@gmail.tmt", - "readNotifications": {} - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "name": "Stud1", @@ -156,12 +144,6 @@ "institute": "TEAMMATES Test Institute 7", "timeZone": "UTC" }, - "archivedCourse": { - "id": "idOfArchivedCourse", - "name": "Archived Course", - "institute": "TEAMMATES Test Institute 5", - "timeZone": "UTC" - }, "unregisteredCourse": { "id": "idOfUnregisteredCourse", "name": "Unregistered Course", @@ -189,7 +171,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor1 Course1", "email": "instructor1@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -213,7 +194,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor2 Course1", "email": "instructor2@course1.tmt", - "isArchived": false, "role": "Manager", "isDisplayedToStudents": true, "displayedName": "Manager", @@ -237,7 +217,6 @@ "courseId": "idOfTypicalCourse1", "name": "Helper Course1", "email": "helper@course1.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": false, "displayedName": "Helper", @@ -260,7 +239,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor Not Yet Joined Course 1", "email": "instructorNotYetJoinedCourse1@email.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -284,7 +262,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor1 Course2", "email": "instructor1@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -308,7 +285,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor2 Course2", "email": "instructor2@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -332,7 +308,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor1 Course3", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -356,7 +331,6 @@ "courseId": "idOfTypicalCourse3", "name": "Instructor2 Course3", "email": "instructor2@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -380,7 +354,6 @@ "courseId": "idOfTypicalCourse4", "name": "Instructor1 Course4", "email": "instructor1@course3.tmt", - "isArchived": false, "role": "Custom", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -404,7 +377,6 @@ "courseId": "idOfTypicalCourse1", "name": "Instructor3 Course1", "email": "instructor3@course1.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -428,7 +400,6 @@ "courseId": "idOfTypicalCourse2", "name": "Instructor3 Course2", "email": "instructor3@course2.tmt", - "isArchived": false, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -452,7 +423,7 @@ "courseId": "idOfCourseNoEvals", "name": "Instructor4 name", "email": "instructor4@courseNoEvals.tmt", - "isArchived": false, + "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -476,7 +447,7 @@ "courseId": "idOfUnregisteredCourse", "name": "Instructor 5 of CourseNoRegister", "email": "instructor5@courseNoRegister.tmt", - "isArchived": false, + "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -500,31 +471,7 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor With Only One Sample Course", "email": "iwosc@yahoo.tmt", - "isArchived": false, - "role": "Co-owner", - "isDisplayedToStudents": true, - "displayedName": "Instructor", - "privileges": { - "courseLevel": { - "canViewStudentInSections": true, - "canSubmitSessionInSections": true, - "canModifySessionCommentsInSections": true, - "canModifyCourse": true, - "canViewSessionInSections": true, - "canModifySession": true, - "canModifyStudent": true, - "canModifyInstructor": true - }, - "sectionLevel": {}, - "sessionLevel": {} - } - }, - "instructorOfArchivedCourse": { - "googleId": "idOfInstructorOfArchivedCourse", - "courseId": "idOfArchivedCourse", - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "isArchived": true, + "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -548,7 +495,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name1", "email": "instructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -572,7 +518,6 @@ "courseId": "idOfTestingInstructorsDisplayedCourse", "name": "name2", "email": "secondInstructorNotDisplayed@NotDisplayed.tmt", - "isArchived": true, "role": "Co-owner", "isDisplayedToStudents": false, "displayedName": "Instructor", @@ -595,7 +540,7 @@ "courseId": "idOfSampleCourse-demo", "name": "Instructor Not Yet Joined Course", "email": "instructorNotYetJoined@email.tmt", - "isArchived": false, + "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "Instructor", @@ -619,7 +564,7 @@ "courseId": "idOfTestingSanitizationCourse", "name": "Instructor", "email": "instructor1@sanitization.tmt", - "isArchived": false, + "role": "Co-owner", "isDisplayedToStudents": true, "displayedName": "inst'\"/>", @@ -730,15 +675,6 @@ "team": "Team 2", "section": "Section 2" }, - "student1InArchivedCourse": { - "googleId": "student1InArchivedCourse", - "email": "student1InArchivedCourse@gmail.tmt", - "course": "idOfArchivedCourse", - "name": "student1 In Course1", - "comments": "", - "team": "Team 2.1", - "section": "None" - }, "student1InTestingSanitizationCourse": { "googleId": "student1InTestingSanitizationCourse", "email": "normal@sanitization.tmt", @@ -903,9 +839,9 @@ "studentDeadlines": {}, "instructorDeadlines": {} }, - "archiveCourse.session1": { + "noQuestionsCourse.session1": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "creatorEmail": "instructor1@course1.tmt", "instructions": "Please please fill in the following questions.", "createdTime": "2013-01-20T23:00:00Z", @@ -926,9 +862,9 @@ "studentDeadlines": {}, "instructorDeadlines": {} }, - "archiveCourse.session2": { + "noQuestionsCourse.session2": { "feedbackSessionName": "session without instructor questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "creatorEmail": "instructor1@course1.tmt", "instructions": "Please please fill in the following questions.", "createdTime": "2013-01-20T23:00:00Z", @@ -1386,9 +1322,9 @@ "RECEIVER" ] }, - "qn1InSessionInArchivedCourse": { + "qn1InSessionInNoQuestionsCourse": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "questionDetails": { "questionType": "TEXT", "questionText": "Give feedback to students" @@ -1407,9 +1343,9 @@ "RECEIVER" ] }, - "qn1InSession2InArchivedCourse": { + "qn1InSession2InNoQuestionsCourse": { "feedbackSessionName": "session without instructor questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "questionDetails": { "questionType": "TEXT", "questionText": "Give feedback to each other" @@ -1688,10 +1624,10 @@ }, "response1ForNVSQ1": { "feedbackSessionName": "session without student questions", - "courseId": "idOfArchivedCourse", + "courseId": "idOfNoQuestionsCourse", "feedbackQuestionId": "1", - "giver": "instructorOfArchiveCourse@archiveCourse.tmt", - "recipient": "student1InArchivedCourse@gmail.tmt", + "giver": "instructorOfNoQuestionsCourse@noQuestionsCourse.tmt", + "recipient": "student1InNoQuestionsCourse@gmail.tmt", "giverSection": "None", "recipientSection": "Section 1", "responseDetails": { @@ -1961,6 +1897,13 @@ "createdAt": "2011-01-01T00:00:00Z", "registeredAt": "1970-02-14T00:00:00Z" }, + "instructor6": { + "name": "Instructor 6 of CourseNoRegister", + "email": "instructor6@courseNoRegister.tmt", + "institute": "TEAMMATES Test Institute 5", + "createdAt": "2011-01-01T00:00:00Z", + "registeredAt": "1970-02-14T00:00:00Z" + }, "instructorWithoutCourses": { "name": "Instructor Without Courses", "email": "iwc@yahoo.tmt", @@ -1975,13 +1918,6 @@ "createdAt": "2011-01-01T00:00:00Z", "registeredAt": "1970-02-14T00:00:00Z" }, - "instructorOfArchivedCourse": { - "name": "InstructorOfArchiveCourse name", - "email": "instructorOfArchiveCourse@archiveCourse.tmt", - "institute": "TEAMMATES Test Institute 5", - "createdAt": "2011-01-01T00:00:00Z", - "registeredAt": "1970-02-14T00:00:00Z" - }, "instructor1OfTestingSanitizationCourse": { "name": "Instructor", "email": "instructor1@sanitization.tmt", diff --git a/src/web/app/components/session-edit-form/session-edit-form.component.html b/src/web/app/components/session-edit-form/session-edit-form.component.html index 20e978fdf3b..1ef87669847 100644 --- a/src/web/app/components/session-edit-form/session-edit-form.component.html +++ b/src/web/app/components/session-edit-form/session-edit-form.component.html @@ -58,9 +58,6 @@
Or:
-
- There is no un-archived course. -
{{ model.courseId }}
@@ -329,7 +326,6 @@
Or:
-

You need to have an active(unarchived) course to create a session!

button on the card heading of the course you want to archive.
- Then select Archive in the drop-down menu and click Yes to confirm. -

-

- You can also archive a course from the Courses page.
- Under 'Active Courses', click on the button in the row corresponding to the course you want to archive.
- Then select Archive in the drop-down menu. -

- - - -

- You can view all your archived courses by navigating to the Courses page.
- Scroll to the Archived courses heading. -

-

- The courses you have previously archived are listed here. - In order to access information in an archived course, unarchive the course. -

-
- - -

- To unarchive a course, first view the course that you would like to unarchive in the Courses page.
- Then, click on the button corresponding to the course you want to unarchive. -

-
-

Restoring Deleted Courses

5. Learn about other actions you can perform
  • Search: search for students, teams or sections.
  • -
  • - Archive old courses: archive old courses that you no longer need actively. -
  • diff --git a/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/__snapshots__/copy-instructors-from-other-courses-modal.component.spec.ts.snap b/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/__snapshots__/copy-instructors-from-other-courses-modal.component.spec.ts.snap index 8f8b8ccfcb2..42b1b129068 100644 --- a/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/__snapshots__/copy-instructors-from-other-courses-modal.component.spec.ts.snap +++ b/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/__snapshots__/copy-instructors-from-other-courses-modal.component.spec.ts.snap @@ -75,12 +75,13 @@ exports[`CopyInstructorsFromOtherCoursesModalComponent should snap when feedback class="card" >

    - [FAN0002] (Archived): Test Course 1 + [FAN0002]: Test Course 1
    - [FAN0002] (Archived): Test Course 1 + [FAN0002]: Test Course 1
    @@ -466,12 +469,13 @@ exports[`CopyInstructorsFromOtherCoursesModalComponent should snap when instruct class="card" >
    - [FAN0002] (Archived): Test Course 1 + [FAN0002]: Test Course 1
    - [FAN0002] (Archived): Test Course 1 + [FAN0002]: Test Course 1
    Copy Instructors
    -
    - [{{course.courseId}}]: {{course.courseName}} - [{{course.courseId}}] (Archived): {{course.courseName}} +
    + [{{course.courseId}}]: {{course.courseName}}
    @@ -29,7 +28,7 @@
    - +
    # diff --git a/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/copy-instructors-from-other-courses-modal.component.spec.ts b/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/copy-instructors-from-other-courses-modal.component.spec.ts index c8cf79233d4..f088c5151ea 100644 --- a/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/copy-instructors-from-other-courses-modal.component.spec.ts +++ b/src/web/app/pages-instructor/instructor-course-edit-page/copy-instructors-from-other-courses-modal/copy-instructors-from-other-courses-modal.component.spec.ts @@ -97,7 +97,6 @@ describe('CopyInstructorsFromOtherCoursesModalComponent', () => { courseId: 'FAN0002', courseName: 'Test Course 1', creationTimestamp: new Date('2022-07-26T01:00:15Z').getTime(), - isArchived: true, instructorCandidates: [], instructorCandidatesSortBy: SortBy.NONE, instructorCandidatesSortOrder: SortOrder.ASC, @@ -110,7 +109,6 @@ describe('CopyInstructorsFromOtherCoursesModalComponent', () => { courseId: 'FAN0001', courseName: 'Test Course 2', creationTimestamp: new Date('2022-02-22T22:22:22Z').getTime(), - isArchived: false, instructorCandidates: [], instructorCandidatesSortBy: SortBy.NONE, instructorCandidatesSortOrder: SortOrder.ASC, @@ -123,7 +121,6 @@ describe('CopyInstructorsFromOtherCoursesModalComponent', () => { courseId: 'CS2103T', courseName: 'XXX Software Engineering', creationTimestamp: new Date('2022-06-21T07:51:20Z').getTime(), - isArchived: false, instructorCandidates: [], instructorCandidatesSortBy: SortBy.NONE, instructorCandidatesSortOrder: SortOrder.ASC, diff --git a/src/web/app/pages-instructor/instructor-course-edit-page/instructor-course-edit-page.component.ts b/src/web/app/pages-instructor/instructor-course-edit-page/instructor-course-edit-page.component.ts index b9a23c026ae..0143039221e 100644 --- a/src/web/app/pages-instructor/instructor-course-edit-page/instructor-course-edit-page.component.ts +++ b/src/web/app/pages-instructor/instructor-course-edit-page/instructor-course-edit-page.component.ts @@ -643,10 +643,8 @@ export class InstructorCourseEditPageComponent implements OnInit { forkJoin([ this.courseService.getAllCoursesAsInstructor('active'), - this.courseService.getAllCoursesAsInstructor('archived'), ]).subscribe((values: Courses[]) => { const activeCourses: Courses = values[0]; - const archivedCourses: Courses = values[1]; activeCourses.courses.forEach((course: Course) => { if (course.courseId !== this.courseId && course.institute === this.courseFormModel.course.institute) { @@ -654,24 +652,6 @@ export class InstructorCourseEditPageComponent implements OnInit { courseId: course.courseId, courseName: course.courseName, creationTimestamp: course.creationTimestamp, - isArchived: false, - instructorCandidates: [], - instructorCandidatesSortBy: SortBy.NONE, - instructorCandidatesSortOrder: SortOrder.ASC, - hasInstructorsLoaded: false, - isTabExpanded: false, - hasLoadingFailed: false, - }; - courseTabModels.push(model); - } - }); - archivedCourses.courses.forEach((course: Course) => { - if (course.courseId !== this.courseId && course.institute === this.courseFormModel.course.institute) { - const model: CourseTabModel = { - courseId: course.courseId, - courseName: course.courseName, - creationTimestamp: course.creationTimestamp, - isArchived: true, instructorCandidates: [], instructorCandidatesSortBy: SortBy.NONE, instructorCandidatesSortOrder: SortOrder.ASC, diff --git a/src/web/app/pages-instructor/instructor-courses-page/__snapshots__/instructor-courses-page.component.spec.ts.snap b/src/web/app/pages-instructor/instructor-courses-page/__snapshots__/instructor-courses-page.component.spec.ts.snap index 20e41dcd1b6..27189126382 100644 --- a/src/web/app/pages-instructor/instructor-courses-page/__snapshots__/instructor-courses-page.component.spec.ts.snap +++ b/src/web/app/pages-instructor/instructor-courses-page/__snapshots__/instructor-courses-page.component.spec.ts.snap @@ -1,255 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`InstructorCoursesPageComponent should snap when archived courses are expanded 1`] = ` - -
    - -
    - -
    -
    -
    - Loading... -
    -
    - -
    -

    - - Archived courses -

    -
    -
    - - Archive - -
    - -
    - -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - Course ID - - - - - Course Name - - - - - - Creation Date - - - - - Action(s) -
    - CS2104 - - Can modify archived - - - 5 Nov 2002 - - - - -
    - CS2106 - - Cannot modify archived - - - 5 Nov 2002 - - - - -
    -
    -
    -
    - -`; - exports[`InstructorCoursesPageComponent should snap when courses are still loading 1`] = ` Copy -
    -

    - - Archived courses -

    -
    -
    - - Archive - -
    - -
    - -
    -
    -
    -
    -
    -
    Copy -
    -

    - - Archived courses -

    -
    -
    - - Archive - -
    - -
    - -
    -
    -
    -
    -
    -
    Copy - - @@ -178,74 +174,6 @@

    Active courses

    -
    -

    - Archived courses -

    -
    -
    - Archive -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - -
    - Course ID - - - - - - - Course Name - - - - - - - Creation Date - - - - - - Action(s)
    {{course.course.courseId}}{{course.course.courseName}} - {{course.course.creationTimestamp | date:'d MMM yyyy'}} - - - - -
    -
    -
    -
    -

    diff --git a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.scss b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.scss index 0c20342cadc..249967c48f8 100644 --- a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.scss +++ b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.scss @@ -40,14 +40,6 @@ margin-bottom: 0; } -.archive-body { - padding: 0; -} - -.archive-table { - margin-bottom: 0; -} - .margin-top-30px { margin-top: 30px; } diff --git a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.spec.ts b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.spec.ts index 7722e4f8e6d..a66c9fffba5 100644 --- a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.spec.ts +++ b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.spec.ts @@ -11,7 +11,7 @@ import { SimpleModalService } from '../../../services/simple-modal.service'; import { StudentService } from '../../../services/student.service'; import { TimezoneService } from '../../../services/timezone.service'; import { createMockNgbModalRef } from '../../../test-helpers/mock-ngb-modal-ref'; -import { Course, CourseArchive, Courses, JoinState, Students } from '../../../types/api-output'; +import { Course, Courses, JoinState, Students } from '../../../types/api-output'; import { AjaxLoadingModule } from '../../components/ajax-loading/ajax-loading.module'; import { CourseEditFormComponent } from '../../components/course-edit-form/course-edit-form.component'; import { LoadingRetryModule } from '../../components/loading-retry/loading-retry.module'; @@ -61,29 +61,6 @@ describe('InstructorCoursesPageComponent', () => { }, ]; - const archivedCoursesSnap: any[] = [ - { - course: { - courseId: 'CS2104', - courseName: 'Can modify archived', - timeZone: 'UTC', - creationTimestamp: date3.getTime(), - deletionTimestamp: 0, - }, - canModifyCourse: true, - }, - { - course: { - courseId: 'CS2106', - courseName: 'Cannot modify archived', - timeZone: 'UTC', - creationTimestamp: date3.getTime(), - deletionTimestamp: 0, - }, - canModifyCourse: false, - }, - ]; - const deletedCoursesSnap: any[] = [ { course: { @@ -306,30 +283,20 @@ describe('InstructorCoursesPageComponent', () => { if (courseStatus === 'active') { return of({ courses: [courseCS1231] }); } - if (courseStatus === 'archived') { - return of({ courses: [courseCS3281, courseCS3282] }); - } // softDeleted return of({ courses: [courseST4234] }); }); component.loadInstructorCourses(); - expect(courseSpy).toHaveBeenCalledTimes(3); + expect(courseSpy).toHaveBeenCalledTimes(2); expect(courseSpy).toHaveBeenNthCalledWith(1, 'active'); - expect(courseSpy).toHaveBeenNthCalledWith(2, 'archived'); - expect(courseSpy).toHaveBeenNthCalledWith(3, 'softDeleted'); + expect(courseSpy).toHaveBeenNthCalledWith(2, 'softDeleted'); expect(component.activeCourses.length).toEqual(1); expect(component.activeCourses[0].course.courseId).toEqual('CS1231'); expect(component.activeCourses[0].course.courseName).toEqual('Discrete Structures'); - expect(component.archivedCourses.length).toEqual(2); - expect(component.archivedCourses[0].course.courseId).toEqual('CS3282'); - expect(component.archivedCourses[0].course.courseName).toEqual('Thematic Systems Project II'); - expect(component.archivedCourses[1].course.courseId).toEqual('CS3281'); - expect(component.archivedCourses[1].course.courseName).toEqual('Thematic Systems Project I'); - expect(component.softDeletedCourses.length).toEqual(1); expect(component.softDeletedCourses[0].course.courseId).toEqual('ST4234'); expect(component.softDeletedCourses[0].course.courseName).toEqual('Bayesian Statistics'); @@ -349,42 +316,6 @@ describe('InstructorCoursesPageComponent', () => { expect(component.courseStats.CS1231.unregistered).toEqual(1); }); - it('should archive an active course', () => { - const courseArchiveCS1231: CourseArchive = { - courseId: 'CS1231', - isArchived: true, - }; - component.activeCourses = [courseModelCS1231]; - const courseSpy: SpyInstance = jest.spyOn(courseService, 'changeArchiveStatus') - .mockReturnValue(of(courseArchiveCS1231)); - component.changeArchiveStatus('CS1231', true); - - expect(courseSpy).toHaveBeenCalledTimes(1); - expect(courseSpy).toHaveBeenLastCalledWith('CS1231', { archiveStatus: true }); - - expect(component.activeCourses.length).toEqual(0); - expect(component.archivedCourses.length).toEqual(1); - expect(component.archivedCourses[0].course.courseId).toEqual('CS1231'); - }); - - it('should unarchive an archived course', () => { - const courseArchiveCS1231: CourseArchive = { - courseId: 'CS1231', - isArchived: false, - }; - component.archivedCourses = [courseModelCS1231]; - const courseSpy: SpyInstance = jest.spyOn(courseService, 'changeArchiveStatus') - .mockReturnValue(of(courseArchiveCS1231)); - component.changeArchiveStatus('CS1231', false); - - expect(courseSpy).toHaveBeenCalledTimes(1); - expect(courseSpy).toHaveBeenNthCalledWith(1, 'CS1231', { archiveStatus: false }); - - expect(component.archivedCourses.length).toEqual(0); - expect(component.activeCourses.length).toEqual(1); - expect(component.activeCourses[0].course.courseId).toEqual('CS1231'); - }); - it('should soft delete a course', async () => { component.activeCourses = [courseModelCS1231]; const courseSpy: SpyInstance = jest.spyOn(courseService, 'binCourse').mockReturnValue(of(courseCS1231)); @@ -401,7 +332,6 @@ describe('InstructorCoursesPageComponent', () => { }); it('should permanently delete a course', async () => { - component.archivedCourses = [courseModelCS1231]; const courseSpy: SpyInstance = jest.spyOn(courseService, 'deleteCourse') .mockReturnValue(of({ message: 'Message' })); jest.spyOn(simpleModalService, 'openConfirmationModal').mockReturnValue( @@ -450,17 +380,6 @@ describe('InstructorCoursesPageComponent', () => { expect(button.className).toContain('disabled'); }); - it('should disable delete button when instructor cannot modify archived course', () => { - component.archivedCourses = [courseModelST4234]; - component.isLoading = false; - component.isArchivedCourseExpanded = true; - fixture.detectChanges(); - - const button: any = fixture.debugElement.nativeElement.querySelector('#btn-soft-delete-archived-disabled-0'); - expect(button.textContent).toEqual(' Delete '); - expect(button.className).toContain('disabled'); - }); - it('should disable restore and permanently delete buttons when instructor cannot modify deleted course', () => { component.softDeletedCourses = [courseModelST4234]; component.isLoading = false; @@ -521,7 +440,6 @@ describe('InstructorCoursesPageComponent', () => { it('should snap with all courses in course stats', () => { component.activeCourses = activeCoursesSnap; - component.archivedCourses = archivedCoursesSnap; component.softDeletedCourses = deletedCoursesSnap; component.courseStats = courseStatsSnap; component.isLoading = false; @@ -531,7 +449,6 @@ describe('InstructorCoursesPageComponent', () => { it('should snap when it is undeletable and unrestorable', () => { component.activeCourses = activeCoursesSnap; - component.archivedCourses = archivedCoursesSnap; component.softDeletedCourses = deletedCoursesSnap; component.courseStats = courseStatsSnap; component.canDeleteAll = false; @@ -568,11 +485,4 @@ describe('InstructorCoursesPageComponent', () => { fixture.detectChanges(); expect(fixture).toMatchSnapshot(); }); - - it('should snap when archived courses are expanded', () => { - component.archivedCourses = archivedCoursesSnap; - component.isArchivedCourseExpanded = true; - fixture.detectChanges(); - expect(fixture).toMatchSnapshot(); - }); }); diff --git a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.ts b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.ts index 8ea36a7390c..43f45ed4aad 100644 --- a/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.ts +++ b/src/web/app/pages-instructor/instructor-courses-page/instructor-courses-page.component.ts @@ -12,7 +12,6 @@ import { StudentService } from '../../../services/student.service'; import { TableComparatorService } from '../../../services/table-comparator.service'; import { Course, - CourseArchive, Courses, FeedbackSession, FeedbackSessions, @@ -53,7 +52,6 @@ interface CourseModel { export class InstructorCoursesPageComponent implements OnInit { activeCourses: CourseModel[] = []; - archivedCourses: CourseModel[] = []; softDeletedCourses: CourseModel[] = []; allCoursesList: Course[] = []; activeCoursesList: Course[] = []; @@ -63,8 +61,6 @@ export class InstructorCoursesPageComponent implements OnInit { activeTableSortOrder: SortOrder = SortOrder.ASC; activeTableSortBy: SortBy = SortBy.COURSE_CREATION_DATE; - archivedTableSortOrder: SortOrder = SortOrder.ASC; - archivedTableSortBy: SortBy = SortBy.COURSE_NAME; deletedTableSortOrder: SortOrder = SortOrder.ASC; deletedTableSortBy: SortBy = SortBy.COURSE_NAME; @@ -79,7 +75,6 @@ export class InstructorCoursesPageComponent implements OnInit { canDeleteAll: boolean = true; canRestoreAll: boolean = true; isAddNewCourseFormExpanded: boolean = false; - isArchivedCourseExpanded: boolean = false; isCopyingCourse: boolean = false; copyProgressPercentage: number = 0; @@ -120,7 +115,6 @@ export class InstructorCoursesPageComponent implements OnInit { this.hasLoadingFailed = false; this.isLoading = true; this.activeCourses = []; - this.archivedCourses = []; this.softDeletedCourses = []; this.activeCoursesList = []; this.allCoursesList = []; @@ -148,27 +142,6 @@ export class InstructorCoursesPageComponent implements OnInit { this.statusMessageService.showErrorToast(resp.error.message); }); - this.courseService.getAllCoursesAsInstructor('archived').subscribe((resp: Courses) => { - for (const course of resp.courses) { - this.allCoursesList.push(course); - let canModifyCourse: boolean = false; - let canModifyStudent: boolean = false; - if (course.privileges) { - canModifyCourse = course.privileges.canModifyCourse; - canModifyStudent = course.privileges.canModifyStudent; - } - const isLoadingCourseStats: boolean = false; - const archivedCourse: CourseModel = { - course, canModifyCourse, canModifyStudent, isLoadingCourseStats, - }; - this.archivedCourses.push(archivedCourse); - this.archivedCoursesDefaultSort(); - } - }, (resp: ErrorMessageOutput) => { - this.hasLoadingFailed = true; - this.statusMessageService.showErrorToast(resp.error.message); - }); - this.courseService.getAllCoursesAsInstructor('softDeleted').subscribe((resp: Courses) => { for (const course of resp.courses) { this.allCoursesList.push(course); @@ -225,58 +198,6 @@ export class InstructorCoursesPageComponent implements OnInit { }); } - /** - * Changes the status of an archived course. - */ - changeArchiveStatus(courseId: string, toArchive: boolean): void { - if (!courseId) { - this.statusMessageService.showErrorToast(`Course ${courseId} is not found!`); - return; - } - this.courseService.changeArchiveStatus(courseId, { - archiveStatus: toArchive, - }).subscribe((courseArchive: CourseArchive) => { - if (courseArchive.isArchived) { - this.changeModelFromActiveToArchived(courseId); - this.statusMessageService.showSuccessToast(`The course ${courseId} has been archived. - It will not appear on the home page anymore.`); - } else { - this.changeModelFromArchivedToActive(courseId); - this.statusMessageService.showSuccessToast('The course has been unarchived.'); - } - }, (resp: ErrorMessageOutput) => { - this.statusMessageService.showErrorToast(resp.error.message); - }); - } - - /** - * Moves a course model from active courses list to archived list. - * This is to reduce the need to refresh the entire list of courses multiple times. - */ - changeModelFromActiveToArchived(courseId: string): void { - const courseToBeRemoved: CourseModel | undefined = this.findCourse(this.activeCourses, courseId); - this.activeCourses = this.removeCourse(this.activeCourses, courseId); - this.activeCoursesList = this.activeCourses.map((courseModel: CourseModel) => courseModel.course); - if (courseToBeRemoved !== undefined) { - this.archivedCourses.push(courseToBeRemoved); - this.archivedCourses.sort(this.sortBy(this.archivedTableSortBy, this.archivedTableSortOrder)); - } - } - - /** - * Moves a course model from archived courses list to active list. - * This is to reduce the need to refresh the entire list of courses multiple times. - */ - changeModelFromArchivedToActive(courseId: string): void { - const courseToBeRemoved: CourseModel | undefined = this.findCourse(this.archivedCourses, courseId); - this.archivedCourses = this.removeCourse(this.archivedCourses, courseId); - if (courseToBeRemoved !== undefined) { - this.activeCourses.push(courseToBeRemoved); - this.activeCoursesList = this.activeCourses.map((courseModel: CourseModel) => courseModel.course); - this.activeCourses.sort(this.sortBy(this.activeTableSortBy, this.activeTableSortOrder)); - } - } - /** * Creates new course */ @@ -449,7 +370,7 @@ export class InstructorCoursesPageComponent implements OnInit { } /** - * Moves an active/archived course to Recycle Bin. + * Moves an active course to Recycle Bin. */ onDelete(courseId: string): Promise { if (!courseId) { @@ -471,7 +392,7 @@ export class InstructorCoursesPageComponent implements OnInit { } /** - * Moves an active/archived course to Recycle Bin. + * Moves an active course to Recycle Bin. * This is to reduce the need to refresh the entire list of courses multiple times. */ moveCourseToRecycleBin(courseId: string, deletionTimeStamp: number): void { @@ -482,14 +403,6 @@ export class InstructorCoursesPageComponent implements OnInit { activeCourseToBeRemoved.course.deletionTimestamp = deletionTimeStamp; this.softDeletedCourses.push(activeCourseToBeRemoved); this.softDeletedCourses.sort(this.sortBy(this.deletedTableSortBy, this.deletedTableSortOrder)); - } else { - const archivedCourseToBeRemoved: CourseModel | undefined = this.findCourse(this.archivedCourses, courseId); - this.archivedCourses = this.removeCourse(this.archivedCourses, courseId); - if (archivedCourseToBeRemoved !== undefined) { - archivedCourseToBeRemoved.course.deletionTimestamp = deletionTimeStamp; - this.softDeletedCourses.push(archivedCourseToBeRemoved); - this.softDeletedCourses.sort(this.sortBy(this.deletedTableSortBy, this.deletedTableSortOrder)); - } } } @@ -597,7 +510,6 @@ export class InstructorCoursesPageComponent implements OnInit { this.softDeletedCourses = []; this.allCoursesList = []; this.allCoursesList.push(...this.activeCourses.map((courseModel: CourseModel) => courseModel.course)); - this.allCoursesList.push(...this.archivedCourses.map((courseModel: CourseModel) => courseModel.course)); this.statusMessageService.showSuccessToast('All courses have been permanently deleted.'); }, (resp: ErrorMessageOutput) => { this.statusMessageService.showErrorToast(resp.error.message); @@ -641,25 +553,6 @@ export class InstructorCoursesPageComponent implements OnInit { this.activeCourses.sort(this.sortBy(this.activeTableSortBy, this.activeTableSortOrder)); } - /** - * Sorts the archived courses table - */ - sortArchivedCoursesEvent(by: SortBy): void { - this.archivedTableSortOrder = this.archivedTableSortBy === by && this.archivedTableSortOrder === SortOrder.ASC - ? SortOrder.DESC : SortOrder.ASC; - this.archivedTableSortBy = by; - this.archivedCourses.sort(this.sortBy(by, this.archivedTableSortOrder)); - } - - /** - * Archived courses default sort on page load - */ - archivedCoursesDefaultSort(): void { - this.archivedTableSortBy = SortBy.COURSE_CREATION_DATE; - this.archivedTableSortOrder = SortOrder.DESC; - this.archivedCourses.sort(this.sortBy(this.archivedTableSortBy, this.archivedTableSortOrder)); - } - /** * Sorts the soft-deleted courses table */ diff --git a/src/web/app/pages-instructor/instructor-home-page/__snapshots__/instructor-home-page.component.spec.ts.snap b/src/web/app/pages-instructor/instructor-home-page/__snapshots__/instructor-home-page.component.spec.ts.snap index f4eb026c128..9efd2e3f753 100644 --- a/src/web/app/pages-instructor/instructor-home-page/__snapshots__/instructor-home-page.component.spec.ts.snap +++ b/src/web/app/pages-instructor/instructor-home-page/__snapshots__/instructor-home-page.component.spec.ts.snap @@ -473,13 +473,6 @@ exports[`InstructorHomePageComponent should snap with one course with one feedba ngbdropdownmenu="" x-placement="bottom" > - - Archive - - - Archive - - - Archive - - - Archive - - - Archive - Home

    - Archive - View / Edit diff --git a/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.spec.ts b/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.spec.ts index 18d8d4ef63c..0c8f230c7e7 100644 --- a/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.spec.ts +++ b/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.spec.ts @@ -8,7 +8,7 @@ import { FeedbackSessionsService } from '../../../services/feedback-sessions.ser import { SimpleModalService } from '../../../services/simple-modal.service'; import { createMockNgbModalRef } from '../../../test-helpers/mock-ngb-modal-ref'; import { - Course, CourseArchive, Courses, + Course, Courses, FeedbackSession, FeedbackSessionPublishStatus, FeedbackSessions, @@ -173,37 +173,6 @@ describe('InstructorHomePageComponent', () => { expect(component.courseTabModels[0].isTabExpanded).toBeTruthy(); }); - it('should archive the entire course from the instructor', () => { - const courseArchive: CourseArchive = { - courseId: 'CS1231', - isArchived: true, - }; - - component.courseTabModels = activeCourseTabModels; - component.hasCoursesLoaded = true; - fixture.detectChanges(); - - expect(component.courseTabModels.length).toEqual(2); - expect(component.courseTabModels[0].course.courseId).toEqual('CS1231'); - expect(component.courseTabModels[0].course.courseName).toEqual('Discrete Structures'); - - jest.spyOn(simpleModalService, 'openConfirmationModal').mockImplementation( - () => createMockNgbModalRef({ - header: 'mock header', content: 'mock content', type: SimpleModalType.INFO, - }), - ); - jest.spyOn(courseService, 'changeArchiveStatus').mockReturnValue(of(courseArchive)); - - const courseButton: any = fixture.debugElement.nativeElement.querySelector('#btn-course'); - courseButton.click(); - const archiveButton: any = fixture.debugElement.nativeElement.querySelector('#btn-archive-course'); - archiveButton.click(); - - expect(component.courseTabModels.length).toEqual(1); - expect(component.courseTabModels[0].course.courseId).toEqual('CS3281'); - expect(component.courseTabModels[0].course.courseName).toEqual('Thematic Systems I'); - }); - it('should delete the entire course from the instructor', () => { const courseToDelete: Course = testCourse1; @@ -224,8 +193,8 @@ describe('InstructorHomePageComponent', () => { const courseButton: any = fixture.debugElement.nativeElement.querySelector('#btn-course'); courseButton.click(); - const archiveButton: any = fixture.debugElement.nativeElement.querySelector('#btn-delete-course'); - archiveButton.click(); + const deleteButton: any = fixture.debugElement.nativeElement.querySelector('#btn-delete-course'); + deleteButton.click(); expect(component.courseTabModels.length).toEqual(1); expect(component.courseTabModels[0].course.courseId).toEqual('CS3281'); diff --git a/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.ts b/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.ts index 372b9d1a287..8afe07f00ea 100644 --- a/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.ts +++ b/src/web/app/pages-instructor/instructor-home-page/instructor-home-page.component.ts @@ -15,7 +15,6 @@ import { StudentService } from '../../../services/student.service'; import { TableComparatorService } from '../../../services/table-comparator.service'; import { Course, - CourseArchive, Courses, FeedbackSession, FeedbackSessions, @@ -115,31 +114,6 @@ export class InstructorHomePageComponent extends InstructorSessionModalPageCompo return courseTabModel.isTabExpanded; } - /** - * Archives the entire course from the instructor - */ - archiveCourse(courseId: string): void { - const modalContent: string = - 'This action can be reverted by going to the "Courses" tab and unarchiving the desired course(s).'; - - const modalRef: NgbModalRef = - this.simpleModalService.openConfirmationModal( - `Archive course ${courseId}?`, SimpleModalType.INFO, modalContent); - modalRef.result.then(() => { - this.courseService.changeArchiveStatus(courseId, { - archiveStatus: true, - }).subscribe((courseArchive: CourseArchive) => { - this.courseTabModels = this.courseTabModels.filter((model: CourseTabModel) => { - return model.course.courseId !== courseId; - }); - this.statusMessageService.showSuccessToast(`The course ${courseArchive.courseId} has been archived. - You can retrieve it from the Courses page.`); - }, (resp: ErrorMessageOutput) => { - this.statusMessageService.showErrorToast(resp.error.message); - }); - }, () => {}); - } - /** * Deletes the entire course from the instructor */ diff --git a/src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.html b/src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.html index 41a581109ce..4a40ad17af3 100644 --- a/src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.html +++ b/src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.html @@ -1,5 +1,5 @@
    @@ -47,8 +47,8 @@

    - Note: The table above doesn't contain sessions from archived courses and courses in recycle bin. - To view sessions from an archived course, unarchive the course first; to view sessions from a course in recycle bin, restore the course first. + Note: The table above doesn't contain sessions from courses in recycle bin. + To view sessions from a course in recycle bin, restore the course first.

    diff --git a/src/web/services/course.service.spec.ts b/src/web/services/course.service.spec.ts index 78477af968b..820bac22983 100644 --- a/src/web/services/course.service.spec.ts +++ b/src/web/services/course.service.spec.ts @@ -1,7 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import { ResourceEndpoints } from '../types/api-const'; -import { CourseArchiveRequest, CourseCreateRequest, CourseUpdateRequest } from '../types/api-request'; +import { CourseCreateRequest, CourseUpdateRequest } from '../types/api-request'; import { CourseService } from './course.service'; import { HttpRequestService } from './http-request.service'; @@ -86,14 +86,9 @@ describe('CourseService', () => { entitytype: 'instructor', user: googleId, }; - const archivedCoursesParamMap: { [key: string]: string } = { - coursestatus: 'archived', - entitytype: 'instructor', - user: googleId, - }; + service.getInstructorCoursesInMasqueradeMode(googleId); expect(spyHttpRequestService.get).toHaveBeenCalledWith(ResourceEndpoints.COURSES, activeCoursesParamMap); - expect(spyHttpRequestService.get).toHaveBeenCalledWith(ResourceEndpoints.COURSES, archivedCoursesParamMap); }); it('should execute GET when getting all active instructor courses', () => { @@ -136,17 +131,6 @@ describe('CourseService', () => { expect(spyHttpRequestService.delete).toHaveBeenCalledWith(ResourceEndpoints.COURSE, paramMap); }); - it('should execute PUT to archive course', () => { - const courseid: string = 'test-id'; - const request: CourseArchiveRequest = { - archiveStatus: true, - }; - const paramMap: { [key: string]: string } = { courseid }; - service.changeArchiveStatus(courseid, request); - expect(spyHttpRequestService.put) - .toHaveBeenCalledWith(ResourceEndpoints.COURSE_ARCHIVE, paramMap, request); - }); - it('should execute PUT to bin course', () => { const courseid: string = 'test-id'; const paramMap: { [key: string]: string } = { courseid }; diff --git a/src/web/services/course.service.ts b/src/web/services/course.service.ts index a53943a424b..6808f9f0635 100644 --- a/src/web/services/course.service.ts +++ b/src/web/services/course.service.ts @@ -2,8 +2,8 @@ import { Injectable } from '@angular/core'; import { forkJoin, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ResourceEndpoints } from '../types/api-const'; -import { Course, CourseArchive, Courses, HasResponses, JoinStatus, MessageOutput, Student } from '../types/api-output'; -import { CourseArchiveRequest, CourseCreateRequest, CourseUpdateRequest } from '../types/api-request'; +import { Course, Courses, HasResponses, JoinStatus, MessageOutput, Student } from '../types/api-output'; +import { CourseCreateRequest, CourseUpdateRequest } from '../types/api-request'; import { HttpRequestService } from './http-request.service'; /** @@ -95,15 +95,9 @@ export class CourseService { entitytype: 'instructor', user: googleId, }; - const archivedCoursesParamMap: Record = { - coursestatus: 'archived', - entitytype: 'instructor', - user: googleId, - }; return forkJoin([ this.httpRequestService.get(ResourceEndpoints.COURSES, activeCoursesParamMap), - this.httpRequestService.get(ResourceEndpoints.COURSES, archivedCoursesParamMap), ]).pipe( map((vals: Courses[]) => { return { @@ -149,14 +143,6 @@ export class CourseService { return this.httpRequestService.delete(ResourceEndpoints.COURSE, paramMap); } - /** - * Changes the archive status of a course by calling API. - */ - changeArchiveStatus(courseid: string, request: CourseArchiveRequest): Observable { - const paramMap: Record = { courseid }; - return this.httpRequestService.put(ResourceEndpoints.COURSE_ARCHIVE, paramMap, request); - } - /** * Bin (soft-delete) a course by calling API. */