Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-T15-1#234 from ararchch/branch-Up…
Browse files Browse the repository at this point in the history
…dateUg

Updated DG
  • Loading branch information
alfaloo authored Apr 15, 2024
2 parents 0b4c9fe + 3a8556c commit e24edd6
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 43 deletions.
130 changes: 93 additions & 37 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/diagrams/AppointmentClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1
skinparam arrowColor UI_COLOR_T4
skinparam classBackgroundColor UI_COLOR

Class "Appointment" as Appointment
Class Nric
Class AppointmentId
Class AppointmentDateTime



Appointment -down-> "1" Nric : Doctor's NRIC\t
Appointment -down-> "1" Nric : Patient's NRIC\t\t
Appointment -down-> "\t1" AppointmentDateTime
Appointment -down-> "\t1" AppointmentId


@enduml

20 changes: 20 additions & 0 deletions docs/diagrams/AppointmentObjectDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1
skinparam arrowColor UI_COLOR_T4
skinparam classBackgroundColor UI_COLOR

object "__:Appointment__" as appointment
object "__doctorNric:Nric__" as doctorNric
object "__patientNric:Nric__" as patientNric
object "__appointmentDateTime:AppointmentDateTime__" as appointmentDate
object "__appointmentId:AppointmentId__" as appointmentId


appointment -down-> doctorNric
appointment -down-> patientNric
appointment -down-> appointmentDate
appointment -down-> appointmentId


@enduml
Binary file added docs/images/AppointmentClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/AppointmentObjectDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Appointment(
requireAllNonNull(doctorNric, patientNric, appointmentDateTime);

try {
checkArgument(isValidAppointment(appointmentDateTime), MESSAGE_CONSTRAINTS_INVALID_DATE);
checkArgument(isValidAppointmentDateTime(appointmentDateTime), MESSAGE_CONSTRAINTS_INVALID_DATE);
} catch (IllegalArgumentException e) {
throw new ParseException(e.getMessage());
}
Expand All @@ -64,7 +64,7 @@ public Appointment(
public Appointment(Nric doctorNric, Nric patientNric, AppointmentDateTime appointmentDateTime,
AppointmentId appointmentId) {
requireAllNonNull(doctorNric, patientNric, appointmentDateTime);
checkArgument(isValidAppointment(appointmentDateTime), MESSAGE_CONSTRAINTS_INVALID_DATE);
checkArgument(isValidAppointmentDateTime(appointmentDateTime), MESSAGE_CONSTRAINTS_INVALID_DATE);
this.doctorNric = doctorNric;
this.patientNric = patientNric;
this.appointmentDateTime = appointmentDateTime;
Expand Down Expand Up @@ -96,7 +96,7 @@ public Appointment(
* @param appointmentDate Date to check validity of
* @return boolean if appointment is valid or not
*/
public boolean isValidAppointment(AppointmentDateTime appointmentDate) {
public boolean isValidAppointmentDateTime(AppointmentDateTime appointmentDate) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
AppointmentDateTime currentDateTime = new AppointmentDateTime(LocalDateTime.now().format(formatter));
return appointmentDate.compareTo(currentDateTime) > -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void getAppointmentDate() throws ParseException {
}

@Test
void isValidAppointment_validDate_returnsTrue() throws ParseException {
void isValidAppointmentDateTime_validDate_returnsTrue() throws ParseException {
AppointmentDateTime futureDateTime = new AppointmentDateTime(LocalDateTime.now().plusDays(1));
Appointment appointment = new Appointment(new Nric("S1234567A"), new Nric("T1234567A"), futureDateTime);

assertTrue(appointment.isValidAppointment(futureDateTime));
assertTrue(appointment.isValidAppointmentDateTime(futureDateTime));
}

@Test
void isValidAppointment_pastDate_returnsFalse() {
void isValidAppointmentDateTime_pastDate_returnsFalse() {
AppointmentDateTime pastDateTime = new AppointmentDateTime(LocalDateTime.now().minusDays(1));
// Use assertThrows to check if IllegalArgumentException is thrown
assertThrows(ParseException.class, () -> {
Expand Down

0 comments on commit e24edd6

Please sign in to comment.