Skip to content

Commit

Permalink
Merge pull request #252 from lululwtv/master
Browse files Browse the repository at this point in the history
Update lululwtv.md
  • Loading branch information
owenyeo authored Nov 8, 2023
2 parents 8f400a8 + 8871e0c commit 2d21ae1
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 50 deletions.
14 changes: 9 additions & 5 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Nice! Now you know the basic commands and have launched TimetaBRO, lets get into
* If you are using a PDF version of this document, be careful when copying and pasting commands that span multiple lines as space characters surrounding line-breaks may be omitted when copied over to the application.
</div>

* Clicking on your friend's name will display their timetable on the right hand side.

### Viewing help : `help`

Shows a message explaining how to access the help page.
Expand All @@ -70,7 +72,7 @@ Format: `help`

Adds a person to TimetaBRO.

Format: `add n/NAME [u/NICKNAME] p/PHONE_NUMBER t/TELEGRAM_HANDLE e/EMAIL [m/MODULE /from START_TIME /to END_TIME /day DAY] [t/TAG]`
Format: `add n/NAME p/PHONE_NUMBER b/BIRTHDAY a/ADDRESS e/EMAIL [t/TAG]`

<div markdown="span" class="alert alert-primary">Tip:
A person can have any number of tags (including 0)
Expand All @@ -85,8 +87,8 @@ Unsuccessful Command:
- `Wrong inputs for prefix: {prefix with error}`

Examples:
* `add n/John Doe p/98765432 t/johndoe e/[email protected] m/CS2103T /from 1200 /to 1300 /day Wednesday t/police`
* `add n/Betsy Crowe t/betsycrowe e/[email protected] p/1234567 m/CS2101 /from 1200 /to 1400 /day Monday, Thursday t/criminal`
* `add n/John Doe p/98765432 e/[email protected] t/police b/2001-10-10 a/18 College Ave E, Cinnamon West Learn Lobe, Singapore 138593`
* `add n/Betsy Crowe e/[email protected] p/1234567 t/criminal`

### Listing all persons : `list`

Expand All @@ -107,7 +109,7 @@ Displays an error message. `To list, please run the command ‘list’`

Edits an existing person in TimetaBRO.

Format: `edit INDEX [n/NAME] [p/PHONE_NUMBER] [t/TELEGRAM_HANDLE] [e/EMAIL] [m/MODULE /from START_TIME /to END_TIME /day DAY] [t/TAG]…​`
Format: `edit INDEX [n/NAME] [p/PHONE_NUMBER] [a/ADDRESS] [b/BIRTHDAY] [e/EMAIL] [t/TAG]…​`

* Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​
* At least one of the optional fields must be provided.
Expand All @@ -122,7 +124,7 @@ Changes the specified parameters of specified friend’s profile

Unsuccessful Command:

Displays an error message `Please specify the details to change! Correct syntax: edit INDEX [n/NAME] [p/PHONE_NUMBER] [t/TELEGRAM_HANDLE] [e/EMAIL] [m/MODULE /from START_TIME /to END_TIME /day DAY] [t/TAG]`
Displays an error message `Please specify the details to change! Correct syntax: edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [t/TAG]`


Examples:
Expand Down Expand Up @@ -197,6 +199,7 @@ the specified friend and `INDEX`
- Event date and time will be equal to `DATE TIME`
where `DATE TIME` must be entered in the format `YYYY-MM-DD HHMM [start time] HHMM [end time]`
- Users can set whether they want to enable reminders for this event by inputting `y/n` under `[REMINDER]`
- Event names will be changed to all upper case regardless of whether it was keyed it in lower case or upper case

Successful Command:

Expand Down Expand Up @@ -308,6 +311,7 @@ To add event for friend, use \
the specified friend and `INDEX`
- Event date and time will be equal to `DAY TIME`
where `DAY TIME` must be entered in the format `[monday/tuesday/wednesday/thursday/friday/saturday/sunday] HHMM [start time] HHMM [end time]`
- Event names will be changed to all upper case regardless of whether it was keyed it in lower case or upper case

**Successful Command:**\
Input:
Expand Down
8 changes: 6 additions & 2 deletions docs/team/lululwtv.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@

## Summary of Contributions

**Code contributed:** [Link to your code on tP Code Dashboard]
**Code contributed:** \
https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=w12-4&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code&since=2023-09-22&tabOpen=true&tabType=authorship&zFR=false&tabAuthor=lululwtv&tabRepo=AY2324S1-CS2103T-W12-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false

**Enhancements implemented:**

[to be added later]
- Changed `add` and `edit` commands to allow users to add friend's free times when adding the friend (past iteration) (feature has been removed)
- Created `addschedule`, `rmschedule`, `addevent`, `rmevent` commands
- Created some test cases for the commands made by me
- Fixed seveeral bugs pertaining to `add`, `edit`, `addschedule`, `rmschedule`, `addevent`, `rmevent` commands

**Contributions to the User Guide (UG):**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public CommandResult execute(Model model) throws CommandException {
* @return a message indicating that the user and the given friend have no common free time
*/
public static String createNoOverlapFriendMessage(Person friend) {
return "You and " + friend.getName().toString() + " have no common free time!";
return "You and " + friend.getName().toString() + " have no common free time!\n";
}

/**
Expand Down Expand Up @@ -129,7 +129,7 @@ public StringBuilder createCommonFreeTimeMessage(Person user, Person friend) thr
Schedule friendSchedule = friend.getSchedule();
List<FreeTime> commonFreeTimeWithFriend = userSchedule.getThisWeeksFreeTimesWith(friendSchedule);
if (commonFreeTimeWithFriend.isEmpty()) {
throw new CommandException(createNoOverlapFriendMessage(friend));
return new StringBuilder(createNoOverlapFriendMessage(friend));
} else {
StringBuilder sb = new StringBuilder("You have common free times with "
+ friend.getName().toString()
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/seedu/address/logic/parser/AddEventCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,34 @@ public AddEventCommand parse(String args) throws ParseException {

if (!arePrefixesPresent(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER)) {
List<Prefix> missingPrefix = getMissingPrefixes(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER);
String missingPrefixString = "";
for (Prefix prefix : missingPrefix) {
missingPrefixString += prefix + " ";
}
throw new ParseException(String.format("Missing prefix(es) for %s!\n"
+ "Message Usage:\n" + AddEventCommand.MESSAGE_USAGE, missingPrefixString));
List<Prefix> missingPrefix = getMissingPrefixes(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER);
String missingPrefixString = "";
for (Prefix prefix : missingPrefix) {
missingPrefixString += prefix + " ";
}
throw new ParseException(String.format("Missing prefix(es) for %s!\n"
+ "Message Usage:\n" + AddEventCommand.MESSAGE_USAGE, missingPrefixString));
}

if (!arePrefixesUnique(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER)) {
List<Prefix> duplicatePrefix = getDuplicatePrefixes(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER);
String duplicatePrefixString = "";
for (Prefix prefix : duplicatePrefix) {
duplicatePrefixString += prefix + " ";
}
throw new ParseException(String.format("You can only have 1 of each prefix!\n"
+ "Duplicated prefixes are: " + duplicatePrefixString));
List<Prefix> duplicatePrefix = getDuplicatePrefixes(argMultimap, PREFIX_EVENTNAME,
PREFIX_SCHEDULE, PREFIX_REMINDER);
String duplicatePrefixString = "";
for (Prefix prefix : duplicatePrefix) {
duplicatePrefixString += prefix + " ";
}
throw new ParseException(String.format("You can only have 1 of each prefix!\n"
+ "Duplicated prefixes are: " + duplicatePrefixString));
}

argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_EVENTNAME, PREFIX_SCHEDULE,
PREFIX_REMINDER);

String indexString;

String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toUpperCase();
String schedule = argMultimap.getValue(PREFIX_SCHEDULE).get();
String reminder = argMultimap.getValue(PREFIX_REMINDER).get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ public AddScheduleCommand parse(String args) throws ParseException {

String indexString;

String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toLowerCase();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toUpperCase();
String eventType = argMultimap.getValue(PREFIX_EVENTTYPE).get().toLowerCase();
String schedule = argMultimap.getValue(PREFIX_SCHEDULE).get();

indexString = argMultimap.getPreamble().toLowerCase();

if (indexString.equals("user")) {
return new AddScheduleCommand(eventName, eventType, schedule);
} else {
try {
Integer.parseInt(indexString);
return new AddScheduleCommand(eventName, eventType, ParserUtil.parseIndex(indexString), schedule);
} catch (NumberFormatException e) {
throw new ParseException(String.format("Invalid index!" + "\n"
+ "Index can only be 'user' or a positive integer! \n"));
try {
indexString = argMultimap.getPreamble().toLowerCase();
if (indexString.equals("user")) {
return new AddScheduleCommand(eventName, eventType, schedule);
} else if (Integer.parseInt(indexString) > 0) {
return new AddScheduleCommand(eventName, eventType,
ParserUtil.parseIndex(indexString), schedule);
} else {
throw new ParseException("Invalid index!\n"
+ "Index can only be 'user' or a 'positive integer!' \n");
}
} catch (Exception pe) {
throw new ParseException(String.format("Please input an index!" + "\n"
+ "Message Usage:\n" + AddScheduleCommand.MESSAGE_USAGE));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
* Parses input arguments and creates a new DeleteEventCommand object
*/
public class RemoveEventCommandParser implements Parser<RemoveEventCommand> {

private static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n"
+ RemoveEventCommand.MESSAGE_USAGE;

/**
* Parses the given {@code String} of arguments in the context of the DeleteEventCommand
* and returns a DeleteEventCommand object for execution.
Expand Down Expand Up @@ -48,17 +44,22 @@ public RemoveEventCommand parse(String args) throws ParseException {
+ "Duplicated prefixes are: " + duplicatePrefixString));
}

String indexString;
try {
String indexString = argMultimap.getPreamble().toLowerCase();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toLowerCase();
indexString = argMultimap.getPreamble().toLowerCase();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toUpperCase();
if (indexString.equals("user")) {
return new RemoveEventCommand(eventName, null);
} else if (Integer.parseInt(indexString) > 0) {
return new RemoveEventCommand(eventName, ParserUtil.parseIndex(indexString));
} catch (NumberFormatException e) {
} else {
throw new ParseException(String.format("Invalid index!" + "\n"
+ "Index can only be 'user' or a positive integer! \n"));
}
} catch (Exception pe) {
throw new ParseException(
String.format("Please input an index!\n"
+ "Message Usage:\n" + RemoveEventCommand.MESSAGE_USAGE));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* Parses input arguments and creates a new DeleteEventCommand object
*/
public class RemoveScheduleCommandParser implements Parser<RemoveScheduleCommand> {

private static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n"
+ RemoveScheduleCommand.MESSAGE_USAGE;

/**
* Parses the given {@code String} of arguments in the context of the DeleteEventCommand
* and returns a DeleteEventCommand object for execution.
Expand Down Expand Up @@ -50,7 +46,7 @@ public RemoveScheduleCommand parse(String args) throws ParseException {

try {
String indexString = argMultimap.getPreamble().toLowerCase();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toLowerCase();
String eventName = argMultimap.getValue(PREFIX_EVENTNAME).get().toUpperCase();
String eventType = argMultimap.getValue(PREFIX_EVENTTYPE).get().toLowerCase();
if (indexString.equals("user")) {
return new RemoveScheduleCommand(eventName, eventType, null);
Expand All @@ -61,6 +57,10 @@ public RemoveScheduleCommand parse(String args) throws ParseException {
throw new ParseException("Invalid index!\n"
+ "Index must either be 'user' or a positive integer!\n");
}
} catch (Exception pe) {
throw new ParseException(
String.format("Please input an index!" + "\n"
+ "Message Usage: ", RemoveScheduleCommand.MESSAGE_USAGE));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static DatedEvent newDatedEvent(String unparsedInput) { // e.g., "meet An

// Create the time block
String timeBlockString = dayOfWeek + " " + startTime + " " + endTime;
checkArgument(isValidTimeBlock(timeBlockString), MESSAGE_CONSTRAINTS);

return new DatedEvent(nameString, timeBlockString, dateString, reminder);
}
Expand Down

0 comments on commit 2d21ae1

Please sign in to comment.