Fakultas Ilmu Komputer UI

Commit 00657f08 authored by saddamonpc's avatar saddamonpc
Browse files

Update Admin constructor and Student add appointment method name

parent ad07f9e7
Pipeline #82852 passed with stage
in 2 minutes and 39 seconds
......@@ -20,7 +20,7 @@ public class Main {
UserList userList;
// --------Uncomment this for the "hardcoded" version.
reset();
// reset();
while (true) {
......
......@@ -3,7 +3,6 @@ package softeng.g4.cli;
import softeng.g4.appointment.Appointment;
import softeng.g4.course.CourseList;
import softeng.g4.user.Student;
import softeng.g4.user.TeachingAssistant;
import softeng.g4.user.UserList;
import java.util.Scanner;
......@@ -39,7 +38,7 @@ public class StudentCLI extends CLI {
String endTime = sc.nextLine();
System.out.println("(Optional) Add description for your appointment: ");
String description = sc.nextLine();
currentStudent.setAppointment(day, ta, startTime, endTime, description, userList);
currentStudent.addAppointment(day, ta, startTime, endTime, description, userList);
System.out.println("Successfully added a new appointment!");
break;
......
......@@ -9,12 +9,10 @@ import java.util.ArrayList;
public class Course implements Serializable {
private String name;
private String courseId;
private ArrayList<Student> students = new ArrayList<Student>();
private ArrayList<TeachingAssistant> teachingAssistants = new ArrayList<TeachingAssistant>();
private String professor;
private int sks;
private int coordinatorRoleIndex;
private boolean adminPermission;
// Constructor
public Course(String name, String courseId, String professor, int sks, CourseList courseList) {
......@@ -22,7 +20,6 @@ public class Course implements Serializable {
this.courseId = courseId;
this.professor = professor;
this.sks = sks;
this.adminPermission = false;
courseList.courseList.add(this);
}
......
......@@ -5,14 +5,11 @@ import softeng.g4.course.Course;
import softeng.g4.course.CourseList;
public class Admin extends User {
private String username;
private String fullname;
private String role;
public Admin(String username, String fullname, UserList userList) {
this.username = username;
this.fullname = fullname;
this.role = "A";
this.setUsername(username);
this.setFullname(fullname);
this.setRole("A");
this.setSeeCalendarStrategy(new SeeCalendarCheckPermission());
// Register new Admin to the userList
......@@ -55,16 +52,4 @@ public class Admin extends User {
searchedTA.setAskPermissionAdmin(this);
System.out.println("You have successfully asked " + searchedTA.getUsername() + " to see their calendar!");
}
public String toString() {
return username + " - " + fullname;
}
public String getRole() {
return role;
}
public String getUsername() {
return username;
}
}
......@@ -18,7 +18,7 @@ public class Student extends UserStudent {
}
// Adds appointment with the corresponding TeachingAssistant
public void setAppointment(String date, String TAUsername,
public void addAppointment(String date, String TAUsername,
String startTime, String endTime, String description, UserList userList) {
TeachingAssistant ta = userList.searchTA(TAUsername);
if (ta.getUsername().equals("falseTA")) {
......
package softeng.g4.user;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -96,7 +95,7 @@ class TeachingAssistantTest {
@Test
void acceptAppointment() {
testStudent.setAppointment(
testStudent.addAppointment(
"31/12", "testTa", "08:00", "09:40", "testDesc", userList);
testTa.acceptAppointment(testTa.getAppointmentList().get(0).getId(), userList);
assertEquals(testTa.getAppointmentList().get(0).getStatus(), "Accepted");
......@@ -105,7 +104,7 @@ class TeachingAssistantTest {
@Test
void rejectAppointment() {
testStudent.setAppointment(
testStudent.addAppointment(
"31/12", "testTa", "08:00", "09:40", "testDesc", userList);
testTa.rejectAppointment(testTa.getAppointmentList().get(0).getId(), userList);
assertEquals(testTa.getAppointmentList().get(0).getStatus(), "Rejected");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment