Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-W09-1#196 from GERARDJM018/V1.4-F…
Browse files Browse the repository at this point in the history
…ix-Test

Update DeveloperGuide.md
  • Loading branch information
gosongying authored Apr 15, 2024
2 parents be0859e + 1c152a7 commit 0a74eb3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 70 deletions.
31 changes: 12 additions & 19 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,16 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

### Use cases

(For all use cases below, the **System** is the `HouseKeeping Hub` and the **Actor** is the `operator`, unless specified otherwise)
(For all use cases below, the **System** is the `HouseKeeping Hub` and the **Actor** is the `admin`, unless specified otherwise)

Preconditions: Operator is logged in.
Preconditions: Admin is logged in.

**Use case: UC01 - List clients**

**MSS**

1. Operator requests to list clients
2. HouseKeeping Hub shows the list of clients
1. Admin requests to list clients
2. HouseKeeping Hub shows the unfiltered original list of clients in the client section

Use case ends.

Expand All @@ -498,24 +498,17 @@ Preconditions: Operator is logged in.

**MSS**

1. Operator requests to list housekeepers
2. HouseKeeping Hub shows the list of housekeepers
1. Admin requests to list housekeepers
2. HouseKeeping Hub shows the unfiltered original list of housekeepers in the housekeeper section

Use case ends.

**Extensions**

* 2a. The list is empty.

* 2a1. HouseKeeping Hub shows a message that the list is empty.

Use case ends.

**Use case: UC03 - Add client**

**MSS**

1. Operator requests to add a client
1. Admin requests to add a client
2. HouseKeeping Hub adds the client

Use case ends.
Expand All @@ -538,7 +531,7 @@ Preconditions: Operator is logged in.

**MSS**

1. Operator requests to add a housekeeper
1. Admin requests to add a housekeeper
2. HouseKeeping Hub adds the housekeeper

Use case ends.
Expand All @@ -561,9 +554,9 @@ Preconditions: Operator is logged in.

**MSS**

1. Operator requests to list clients
1. Admin requests to list clients
2. HouseKeeping Hub shows the list of clients
3. Operator requests to delete a specific client in the list
3. Admin requests to delete a specific client in the list
4. HouseKeeping Hub deletes the client

Use case ends.
Expand All @@ -584,9 +577,9 @@ Preconditions: Operator is logged in.

**MSS**

1. Operator requests to list housekeepers
1. Admin requests to list housekeepers
2. HouseKeeping Hub shows the list of housekeepers
3. Operator requests to delete a specific housekeeper in the list
3. Admin requests to delete a specific housekeeper in the list
4. HouseKeeping Hub deletes the housekeeper

Use case ends.
Expand Down
42 changes: 0 additions & 42 deletions src/main/java/housekeeping/hub/logic/commands/BookingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ public class BookingCommand extends Command {
+ "] : edits booking date for the client at the specified index.\n"
+ "Parameters: INDEX bd/DATE(yyyy-mm-dd) TIME(am|pm)\n"
+ "Example: booking client edit 7 bd/2024-01-17 pm\n\n["
+ "edit deferment"
+ "] : adds period to delay before sending reminder about next housekeeping,"
+ " for the client at the specified index.\n"
+ "Parameters: INDEX INTERVAL(number days|weeks|months|years)\n"
+ "Example: booking client edit 10 d/1 months\n\n["
+ "add booking"
+ "] : adds a booking date for the client at the specified index.\n"
+ "Parameters: INDEX DATE(yyyy-mm-dd) TIME(am|pm)\n"
Expand Down Expand Up @@ -170,24 +165,6 @@ public BookingCommand(String type, String actionWord, Index index, HousekeepingD
this.housekeepingDetails = housekeepingDetails;
}

/**
* Constructs a BookingCommand for the "edit" action.
*
* @param type "housekeeper"
* @param actionWord "edit"
* @param index of housekeeper to edit
* @param defer period to add to deferment
*/
public BookingCommand(String type, String actionWord, Index index, Period defer) {
requireNonNull(index);
requireNonNull(defer);
requireNonNull(actionWord);
requireNonNull(type);
this.type = type;
this.actionWord = actionWord;
this.index = index;
this.defer = defer;
}

public BookingCommand() {
}
Expand All @@ -205,8 +182,6 @@ public CommandResult execute(Model model) throws CommandException {
return clientSet(model);
case "remove":
return clientRemove(model);
case "defer":
return clientDefer(model);
default:
throw new CommandException(MESSAGE_INVALID_ACTION);
}
Expand Down Expand Up @@ -297,23 +272,6 @@ private CommandResult clientSet(Model model) throws CommandException {
return editClientCommand.execute(model);
}

private CommandResult clientDefer(Model model) throws CommandException {
List<Client> lastShownList = model.getFilteredClientList();

if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX);
}
Client clientToEdit = lastShownList.get(index.getZeroBased());

if (!clientToEdit.hasHousekeepingDetails()) {
throw new CommandException(NO_DETAILS_MESSAGE_CONSTRAINT);
}

HousekeepingDetails detailsToEdit = clientToEdit.getDetails();
detailsToEdit.addDeferment(defer);
return new CommandResult(String.format(MESSAGE_DEFER_PERSON_SUCCESS, detailsToEdit.getDefermentToString()));
}

private CommandResult clientRemove(Model model) throws CommandException {
List<Client> lastShownList = model.getFilteredClientList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static java.util.Objects.requireNonNull;

import java.time.Period;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -38,7 +37,6 @@ public class BookingCommandParser implements Parser<BookingCommand> {
private static final String ADD_COMMAND = "add";
private static final String DELETE_COMMAND = "delete";
private static final String LIST_COMMAND = "list";
private static final String DEFERMENT_COMMAND = "defer";
private static final String SEARCH_COMMAND = "search";
private static final String EDIT_LAST_HOUSEKEEPING_DATE_COMMAND = "last";
private static final String EDIT_PREFERRED_INTERVAL_COMMAND = "interval";
Expand All @@ -56,12 +54,11 @@ public BookingCommand parse(String args) throws ParseException {
Matcher setMatcher = PATTERN_SET.matcher(args.trim());
Matcher removeMatcher = PATTERN_REMOVE.matcher(args.trim());
Matcher editMatcher = PATTERN_EDIT.matcher(args.trim());
Matcher deferMatcher = PATTERN_DEFERMENT.matcher(args.trim());
if (!typeMatcher.matches()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, BookingCommand.MESSAGE_USAGE));
} else if (typeMatcher.group(1).equals("client")) {
return clientBookingCommandParser(addMatcher, deleteClientMatcher, listMatcher, setMatcher, removeMatcher,
editMatcher, deferMatcher, args);
editMatcher, args);
} else if (typeMatcher.group(1).equals("housekeeper")) {
return housekeeperBookingCommandParser(addMatcher, deleteHousekeeperMatcher, listMatcher, searchMatcher);
} else {
Expand All @@ -72,7 +69,7 @@ public BookingCommand parse(String args) throws ParseException {
private static BookingCommand clientBookingCommandParser(
Matcher addMatcher, Matcher deleteMatcher, Matcher listMatcher,
Matcher setMatcher, Matcher removeMatcher, Matcher editMatcher,
Matcher deferMatcher, String args) throws ParseException {
String args) throws ParseException {
if (setMatcher.matches()) {
Index clientIndex = ParserUtil.parseIndex(setMatcher.group(1));
// Date and period is not really optional since it is guaranteed by the regex.
Expand All @@ -84,10 +81,6 @@ private static BookingCommand clientBookingCommandParser(
return new BookingCommand(CLIENT, REMOVE_HOUSEKEEPING_DETAILS_COMMAND, clientIndex);
} else if (editMatcher.matches()) {
return new EditHousekeepingDetailsParser().parse(args);
} else if (deferMatcher.matches()) {
Period deferment = ParserUtil.parsePreferredInterval(deferMatcher.group(2));
Index clientIndex = ParserUtil.parseIndex(deferMatcher.group(1));
return new BookingCommand(CLIENT, DEFERMENT_COMMAND, clientIndex, deferment);
} else if (addMatcher.matches()) {
Index clientIndex = ParserUtil.parseIndex(addMatcher.group(1));
String bookedDateAndTime = addMatcher.group(2);
Expand Down

0 comments on commit 0a74eb3

Please sign in to comment.