From f94da7386ac8da109de663702c9060ea164b0abd Mon Sep 17 00:00:00 2001 From: zaidansani Date: Mon, 11 Nov 2024 19:52:57 +0800 Subject: [PATCH] Fix bug causing deletion of appointments based on person equality instead of personId equality --- src/main/java/seedu/address/model/AppointmentBook.java | 1 - .../seedu/address/model/appointment/UniqueAppointmentList.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/model/AppointmentBook.java b/src/main/java/seedu/address/model/AppointmentBook.java index e12151a4482..2df21aa14b0 100644 --- a/src/main/java/seedu/address/model/AppointmentBook.java +++ b/src/main/java/seedu/address/model/AppointmentBook.java @@ -129,7 +129,6 @@ public Appointment addAppointment(Person person, AppointmentDescriptor appointme */ public void setAppointment(Appointment target, Appointment editedAppointment) { requireNonNull(editedAppointment); - appointments.setAppointment(target, editedAppointment); } diff --git a/src/main/java/seedu/address/model/appointment/UniqueAppointmentList.java b/src/main/java/seedu/address/model/appointment/UniqueAppointmentList.java index 5ef02a397a3..256b5652e5b 100644 --- a/src/main/java/seedu/address/model/appointment/UniqueAppointmentList.java +++ b/src/main/java/seedu/address/model/appointment/UniqueAppointmentList.java @@ -125,7 +125,7 @@ public void setAppointments(List appointments) { */ public void removeAppointmentsForPerson(Person toRemove) { requireNonNull(toRemove); - internalList.removeIf(appointment -> appointment.getPerson().equals(toRemove)); + internalList.removeIf(appointment -> appointment.getPersonId() == toRemove.getPersonId()); } /**