diff --git a/src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java b/src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java deleted file mode 100644 index 877a0ed4e41d..000000000000 --- a/src/client/java/teammates/client/scripts/DataMigrationForInstructorNullIsArchivedField.java +++ /dev/null @@ -1,46 +0,0 @@ -package teammates.client.scripts; - -import java.lang.reflect.Field; - -import com.googlecode.objectify.cmd.Query; - -import teammates.storage.entity.Instructor; - -/** - * Script to change all null value to false in the isArchived field for Instructor entity. - */ -public class DataMigrationForInstructorNullIsArchivedField extends DataMigrationEntitiesBaseScript { - - public static void main(String[] args) { - new DataMigrationForInstructorNullIsArchivedField().doOperationRemotely(); - } - - @Override - protected Query getFilterQuery() { - return ofy().load().type(Instructor.class); - } - - @Override - protected boolean isPreview() { - return true; - } - - @Override - protected boolean isMigrationNeeded(Instructor instructor) { - try { - Field isArchivedField = instructor.getClass().getDeclaredField("isArchived"); - isArchivedField.setAccessible(true); - return isArchivedField.get(instructor) == null; - } catch (ReflectiveOperationException e) { - return true; - } - } - - @Override - protected void migrateEntity(Instructor instructor) { - instructor.setIsArchived(instructor.getIsArchived()); - - saveEntityDeferred(instructor); - } - -} diff --git a/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java index 5bd9707fd983..5c6c8974bd57 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/InstructorAttributes.java @@ -28,7 +28,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; @@ -41,7 +40,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); @@ -72,7 +70,7 @@ 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) { @@ -103,7 +101,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; @@ -132,14 +129,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; } @@ -185,7 +174,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()); } @@ -385,7 +374,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); @@ -570,7 +558,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(); @@ -580,7 +567,6 @@ private static class UpdateOptions { public String toString() { return "InstructorAttributes.UpdateOptions [" + "name = " + nameOption - + ", isAchieved = " + isArchivedOption + ", roleOption = " + roleOption + ", isDisplayedToStudents = " + isDisplayedToStudentsOption + ", displayedName = " + displayedNameOption @@ -637,11 +623,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 79fb5d816bc2..3165c6f15f2e 100644 --- a/src/main/java/teammates/common/util/Const.java +++ b/src/main/java/teammates/common/util/Const.java @@ -222,7 +222,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"; } @@ -348,7 +347,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 648abf4d9698..0f290d7882db 100644 --- a/src/main/java/teammates/logic/api/Logic.java +++ b/src/main/java/teammates/logic/api/Logic.java @@ -334,13 +334,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. @@ -504,24 +497,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. * @@ -989,7 +964,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 d31dac91d044..2b6395eb8e80 100644 --- a/src/main/java/teammates/logic/core/AccountsLogic.java +++ b/src/main/java/teammates/logic/core/AccountsLogic.java @@ -255,7 +255,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 6df8784010ee..aad351001253 100644 --- a/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java +++ b/src/main/java/teammates/logic/core/FeedbackSessionsLogic.java @@ -144,7 +144,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 0af7387f9338..5dd058170527 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/sqllogic/api/Logic.java b/src/main/java/teammates/sqllogic/api/Logic.java index e9083503f91f..1ce212cffd2b 100644 --- a/src/main/java/teammates/sqllogic/api/Logic.java +++ b/src/main/java/teammates/sqllogic/api/Logic.java @@ -570,7 +570,7 @@ public FeedbackSession getFeedbackSessionFromRecycleBin(String feedbackSessionNa /** * 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 getSoftDeletedFeedbackSessionsForInstructors( List instructorList) { diff --git a/src/main/java/teammates/sqllogic/core/FeedbackSessionsLogic.java b/src/main/java/teammates/sqllogic/core/FeedbackSessionsLogic.java index 01a85cff91ec..212b65cea756 100644 --- a/src/main/java/teammates/sqllogic/core/FeedbackSessionsLogic.java +++ b/src/main/java/teammates/sqllogic/core/FeedbackSessionsLogic.java @@ -153,7 +153,7 @@ public List getFeedbackSessionsForInstructors( /** * 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 getSoftDeletedFeedbackSessionsForInstructors( List instructorList) { diff --git a/src/main/java/teammates/storage/api/InstructorsDb.java b/src/main/java/teammates/storage/api/InstructorsDb.java index ce021f52d4ea..fc7c6e9b9e14 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()); @@ -401,19 +395,6 @@ private List getInstructorEntitiesForGoogleId(String googleId) { return getInstructorsForGoogleIdQuery(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) { - return getInstructorsForGoogleIdQuery(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 282716d629c0..5d75a9dc98d4 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 3a7a3abe88c0..189dd9692324 100644 --- a/src/main/java/teammates/ui/constants/ResourceEndpoints.java +++ b/src/main/java/teammates/ui/constants/ResourceEndpoints.java @@ -21,7 +21,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 2f5021bc79a6..000000000000 --- 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 8e29c81a6da8..000000000000 --- 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 83984fb532dc..9f64daf900ab 100644 --- a/src/main/java/teammates/ui/webapi/ActionFactory.java +++ b/src/main/java/teammates/ui/webapi/ActionFactory.java @@ -59,7 +59,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 919593beaa7c..000000000000 --- 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. - */ -public 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 76e8963e3c16..3e83f2f1ce07 100644 --- a/src/main/java/teammates/ui/webapi/GetCoursesAction.java +++ b/src/main/java/teammates/ui/webapi/GetCoursesAction.java @@ -1,6 +1,5 @@ package teammates.ui.webapi; -import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -20,7 +19,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. */ public class GetCoursesAction extends Action { @@ -88,25 +87,17 @@ private JsonResult getInstructorCourses() { List instructors; List courses; - List sqlInstructors = new ArrayList<>(); - List sqlCourses = new ArrayList<>(); + List sqlInstructors; + List sqlCourses; switch (courseStatus) { case Const.CourseStatus.ACTIVE: - instructors = logic.getInstructorsForGoogleId(userInfo.id, true); + instructors = logic.getInstructorsForGoogleId(userInfo.id); courses = getCourse(instructors); sqlInstructors = sqlLogic.getInstructorsForGoogleId(userInfo.id); sqlCourses = sqlLogic.getCoursesForInstructors(sqlInstructors); - break; - case Const.CourseStatus.ARCHIVED: - instructors = logic.getInstructorsForGoogleId(userInfo.id) - .stream() - .filter(InstructorAttributes::isArchived) - .collect(Collectors.toList()); - courses = getCourse(instructors); - break; case Const.CourseStatus.SOFT_DELETED: instructors = logic.getInstructorsForGoogleId(userInfo.id); diff --git a/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java b/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java index d4c1c1ae9549..e9115d4a2be4 100644 --- a/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java +++ b/src/main/java/teammates/ui/webapi/GetFeedbackSessionsAction.java @@ -124,7 +124,7 @@ public JsonResult execute() { feedbackSessions = sqlLogic.getFeedbackSessionsForInstructors(instructors); } - dataStoreInstructors = logic.getInstructorsForGoogleId(userInfo.getId(), true); + dataStoreInstructors = logic.getInstructorsForGoogleId(userInfo.getId()); if (isInRecycleBin) { feedbackSessionAttributes = logic.getSoftDeletedFeedbackSessionsListForInstructors(dataStoreInstructors); diff --git a/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java b/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java index 46fc8a43de89..41c41a3d753e 100644 --- a/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java +++ b/src/test/java/teammates/common/datatransfer/attributes/InstructorAttributesTest.java @@ -117,7 +117,7 @@ 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); @@ -138,7 +138,7 @@ 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); diff --git a/src/test/java/teammates/sqlui/webapi/GetActionClassesActionTest.java b/src/test/java/teammates/sqlui/webapi/GetActionClassesActionTest.java index cc370a97f385..e0e13607ff97 100644 --- a/src/test/java/teammates/sqlui/webapi/GetActionClassesActionTest.java +++ b/src/test/java/teammates/sqlui/webapi/GetActionClassesActionTest.java @@ -12,7 +12,6 @@ import teammates.ui.webapi.AccountRequestSearchIndexingWorkerAction; import teammates.ui.webapi.Action; import teammates.ui.webapi.AdminExceptionTestAction; -import teammates.ui.webapi.ArchiveCourseAction; import teammates.ui.webapi.BinCourseAction; import teammates.ui.webapi.BinFeedbackSessionAction; import teammates.ui.webapi.CalculateUsageStatisticsAction; @@ -171,7 +170,6 @@ void testExecute() { CreateInstructorAction.class, GetInstructorAction.class, UpdateInstructorAction.class, - ArchiveCourseAction.class, InstructorCourseJoinEmailWorkerAction.class, DeleteStudentAction.class, GetStudentAction.class, diff --git a/src/test/java/teammates/storage/api/InstructorsDbTest.java b/src/test/java/teammates/storage/api/InstructorsDbTest.java index a0a7ae20f56d..ac71f0d8cf53 100644 --- a/src/test/java/teammates/storage/api/InstructorsDbTest.java +++ b/src/test/java/teammates/storage/api/InstructorsDbTest.java @@ -209,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); @@ -220,13 +220,13 @@ public void testGetInstructorsForGoogleId() throws Exception { ______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)); } diff --git a/src/test/java/teammates/ui/webapi/BinCourseActionTest.java b/src/test/java/teammates/ui/webapi/BinCourseActionTest.java index 3b1edbe5efc5..201e62e71c37 100644 --- a/src/test/java/teammates/ui/webapi/BinCourseActionTest.java +++ b/src/test/java/teammates/ui/webapi/BinCourseActionTest.java @@ -60,7 +60,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 b407c2cfb6b3..3ea0571a4096 100644 --- a/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java +++ b/src/test/java/teammates/ui/webapi/GetActionClassesActionTest.java @@ -54,7 +54,6 @@ protected void testExecute() { CreateInstructorAction.class, GetInstructorAction.class, UpdateInstructorAction.class, - ArchiveCourseAction.class, InstructorCourseJoinEmailWorkerAction.class, DeleteStudentAction.class, GetStudentAction.class,