From 7e960f7442f486f829e2938a65efe4e51d9ec1bc Mon Sep 17 00:00:00 2001 From: Xenos F Date: Mon, 19 Feb 2024 12:15:16 +0800 Subject: [PATCH] Move default instructor team entity to const --- .../java/teammates/common/datatransfer/SqlCourseRoster.java | 2 +- src/main/java/teammates/common/util/Const.java | 2 ++ src/main/java/teammates/storage/sqlentity/Instructor.java | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/teammates/common/datatransfer/SqlCourseRoster.java b/src/main/java/teammates/common/datatransfer/SqlCourseRoster.java index dd43e5876e5..83b8021cfb2 100644 --- a/src/main/java/teammates/common/datatransfer/SqlCourseRoster.java +++ b/src/main/java/teammates/common/datatransfer/SqlCourseRoster.java @@ -144,7 +144,7 @@ public ParticipantInfo getInfoForIdentifier(String identifier) { Instructor instructor = getInstructorForEmail(identifier); name = instructor.getName(); - team = instructor.getTeam(); + team = Const.USER_TEAM_ENTITY_FOR_INSTRUCTOR; section = Const.DEFAULT_SECTION_ENTITY; } else if (isTeam) { Student teamMember = getTeamToMembersTable().get(identifier).iterator().next(); diff --git a/src/main/java/teammates/common/util/Const.java b/src/main/java/teammates/common/util/Const.java index 78e0ba0df35..2792a67fc60 100644 --- a/src/main/java/teammates/common/util/Const.java +++ b/src/main/java/teammates/common/util/Const.java @@ -6,6 +6,7 @@ import java.time.Instant; import teammates.storage.sqlentity.Section; +import teammates.storage.sqlentity.Team; /** * Stores constants that are widely used across classes. @@ -19,6 +20,7 @@ public final class Const { public static final String USER_NOBODY_TEXT = "-"; public static final String USER_TEAM_FOR_INSTRUCTOR = "Instructors"; + public static final Team USER_TEAM_ENTITY_FOR_INSTRUCTOR = new Team(null, Const.USER_TEAM_FOR_INSTRUCTOR); public static final String DEFAULT_DISPLAY_NAME_FOR_INSTRUCTOR = "Instructor"; diff --git a/src/main/java/teammates/storage/sqlentity/Instructor.java b/src/main/java/teammates/storage/sqlentity/Instructor.java index 24821a29f61..6848d80ac4b 100644 --- a/src/main/java/teammates/storage/sqlentity/Instructor.java +++ b/src/main/java/teammates/storage/sqlentity/Instructor.java @@ -25,9 +25,6 @@ @Entity @Table(name = "Instructors") public class Instructor extends User { - - private static Team userTeam = new Team(null, Const.USER_TEAM_FOR_INSTRUCTOR); - @Column(nullable = false) private boolean isDisplayedToStudents; @@ -53,7 +50,6 @@ public Instructor(Course course, String name, String email, boolean isDisplayedT this.setDisplayName(displayName); this.setRole(role); this.setPrivileges(privileges); - this.setTeam(userTeam); } public boolean isDisplayedToStudents() {