Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeevz10 committed Oct 31, 2018
2 parents ea8861a + c84a8ce commit 2a65409
Show file tree
Hide file tree
Showing 73 changed files with 1,441 additions and 588 deletions.
2 changes: 0 additions & 2 deletions README.adoc
Expand Up @@ -2,9 +2,7 @@
ifdef::env-github,env-browser[:relfileprefix: docs/]

https://travis-ci.org/CS2113-AY1819S1-T16-2/main[image:https://travis-ci.org/CS2113-AY1819S1-T16-2/main.svg?branch=master[Build Status]]
https://ci.appveyor.com/project/damithc/addressbook-level4[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]]
https://coveralls.io/github/CS2113-AY1819S1-T16-2/main[image:https://coveralls.io/repos/github/CS2113-AY1819S1-T16-2/main/badge.svg?branch=master[Coverage Status]]
https://www.codacy.com/app/damith/addressbook-level4?utm_source=github.com&utm_medium=referral&utm_content=se-edu/addressbook-level4&utm_campaign=Badge_Grade[image:https://api.codacy.com/project/badge/Grade/fc0b7775cf7f4fdeaf08776f3d8e364a[Codacy Badge]]


ifdef::env-github[]
Expand Down
2 changes: 1 addition & 1 deletion _reposense/config.json
Expand Up @@ -4,7 +4,7 @@
{
"githubId": "jieliangang",
"displayName": "ANG...ANG",
"authorNames": ["jieliangang", "jlang"]
"authorNames": ["jieliangang", "jlang", "Jie Liang Ang"]
},
{
"githubId": "fr3ddy4",
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -82,7 +82,7 @@ dependencies {
}

shadowJar {
archiveName = 'addressbook.jar'
archiveName = 'proManage.jar'

destinationDir = file("${buildDir}/jar/")
}
Expand Down
44 changes: 11 additions & 33 deletions docs/DeveloperGuide.adoc
Expand Up @@ -254,7 +254,15 @@ image::SortNewCommand1StateListDiagram.png[width="650"]

image::SortSequenceDiagram.png[width="650"]

==== Design Considerations

===== Committing Event List after sorting
* **Alternative 1 (current choice):** Commits and saves the entire event list.
** Pros: Easy to implement and able to use undo to the previous state.
** Cons: May have performance issues in terms of memory usage.
* **Alternative 2:** Does not commit the event list.
** Pros: Will use less memory.
** Cons: Unable to use undo function to revert back to the previous view.

// end::Sorting[]

Expand All @@ -281,11 +289,13 @@ Storing only the *name* of `Person` in the `Attendees` object of `Event` saves m

We can also have a summarized content of persons (their names) involved in an event. Obtaining the full information of the list of persons in a particular event is not required in the current version of project, but can still be implemented easily with the current `Attendee` structure. This can be done by filtering through the address book based on the person names present in `Attendees`. Thus, there is no need to store any event information in the `Person` object.

Implementation of RemoveCommand is similar to InviteCommand, but removes persons from attendees of events instead.

==== Execution of Command

Given below is an example usage scenario and how the invite mechanism works.

Step 1. The user executes `invite 1 to/1` to invite the 1st person in the address book to the 1st event in the event list. The command text is passed to an instance of the `LogicManager` class.
Step 1. The user inputs `invite 1 to/1` to invite the 1st person in the address book to the 1st event in the event list. The command text is passed to an instance of the `LogicManager` class.

Step 2. The `LogicManager` instance calls `AddressBookParser#parsecommand`, which parses the `invite` command phrase.

Expand Down Expand Up @@ -347,38 +357,6 @@ The same concept can also be applied to events, being able to invite one person
Implementation of this additional feature would require changes to both `InviteCommandParser` and `InviteCommand#execute`.
// end::Invite[]

// tag:: Sorting[]

=== Event Sorting

==== Current Implementation

The sort mechanism is facilitated by Comparator<Event>.
When the sort method for FXObservableList is called, it will take a Comparator object to be used for sorting the list.
The comparator is able to take in two Event class objects and compare the relative parameter values.
The parameter can be `EventName`, `Date` & `StartTime`.
To allow sorting of these parameters, there are three types of comparators.


image::SortNewCommand1StateListDiagram.png[width="650"]

The following sequence diagram shows how the sort operation works:

image::SortSequenceDiagram.png[width="650"]


==== Design Considerations

===== Committing Event List after sorting

* **Alternative 1 (current choice):** Commits and saves the entire event list.
** Pros: Easy to implement and able to use undo to the previous state.
** Cons: May have performance issues in terms of memory usage.
* **Alternative 2:** Does not commit the event list.
** Pros: Will use less memory.
** Cons: Unable to use undo function to revert back to the previous view.

// end::Sorting[]

// tag::dataencryption[]

Expand Down
59 changes: 47 additions & 12 deletions docs/UserGuide.adoc
Expand Up @@ -87,20 +87,29 @@ Example: +

==== Listing all personnel of the company : 'list'

Shows a list of personnel in the company +
Shows a list of all the personnel, , all the events, or those people in the specific department in the project team +
Format/Prompts: +
Enter a command: `list`

Enter command to list all people: `list all people` +
Enter a command to list all the events: `list all events` +
Enter a command to list people in the specific `DEPARTMENT`: `list dep DEPARTMENT`

Example: +
`list dep Admin` +
`list dep Admin Finance`


==== Editing an employee : 'edit'

Edits the details of the employee: +
Format/Prompts: +
Enter a command: `edit LIST_INDEX n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS dep/DEPARTMENT t/TAG…​`
Enter a command: `edit LIST_INDEX p/PHONE_NUMBER e/EMAIL a/ADDRESS dep/DEPARTMENT t/TAG…​`

****
* Edits the event at the specified `INDEX`. The index refers to the index number shown in the displayed event list. The
index *must be a positive integer* 1, 2, 3, ... +
* At least one of the optional fields must be provided.
* Name is not editable
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing t/ without specifying any tags after it.
Expand Down Expand Up @@ -133,14 +142,14 @@ Format: `schedule`

Add employees to the project event at the respective specified INDEX. The index refers to the index number shown in the
displayed person and event list. The index must be a positive integer 1, 2, 3... +
Format: `invite LIST_INDEX to/SCHEDULE_INDEX` +
Format: `invite PERSON_INDEX to/EVENT_INDEX` +
Example: invite 1 to/2

==== Remove employee: `remove`

Removes an employee from the project event. +
Format/Prompts: `remove SCHEDULE_INDEX n/NAME` +
Example: remove 10 n/John Doe
Format/Prompts: `remove PERSON_INDEX from/EVENT_INDEX` +
Example: remove 1 from/2


==== Modifying an event: `editEvent`
Expand Down Expand Up @@ -330,6 +339,19 @@ Example: +
`n/Board Meeting d/Weekly Meeting l/Conference Room 1 date/2018-09-28 s/12:00 e/23:59 ` +
Creates an event named Board Meeting.

==== Listing all personnel of the company : 'list'

Shows a list of all the personnel, , all the events, or those people in the specific department in the project team +
Format/Prompts: +

Enter command to list all people: `list all people` +
Enter a command to list all the events: `list all events` +
Enter a command to list people in the specific `DEPARTMENT`: `list dep DEPARTMENT`

Example: +
`list dep Admin` +
`list dep Admin Finance`

==== Listing all events: `schedule`

Display the full list of events in the project. +
Expand All @@ -345,8 +367,8 @@ Example: invite 1 to/2
==== Remove employee: `remove`

Removes an employee from the project event. +
Format/Prompts: `remove SCHEDULE_INDEX n/NAME` +
Example: remove 10 n/John Doe
Format/Prompts: `remove EVENT_INDEX from/PERSON_INDEX` +
Example: remove 1 from/2


==== Modifying an event: `editEvent`
Expand All @@ -356,7 +378,7 @@ index must be a positive integer 1, 2, 3... +
Input nil if it is not the field to be changed. +
Format/Prompts: +
Enter a command: `editEvent SCHEDULE_INDEX` +
Enter event details: `n/NAME d/DESCRIPTION l/LOCATION date/DATE(DDMMYY) s/START TIME e/END TIME` +
Enter event details: `d/DESCRIPTION l/LOCATION date/DATE(DDMMYY) s/START TIME e/END TIME` +

****
* Edits the event at the specified `INDEX`. The index refers to the index number shown in the displayed event list. The
Expand Down Expand Up @@ -520,6 +542,19 @@ This section is meant for Employees.
Employees can only access his/her own departments' events.
====

==== Listing all personnel of the company : 'list'

Shows a list of all the personnel, , all the events, or those people in the specific department in the project team +
Format/Prompts: +

Enter command to list all people: `list all people` +
Enter a command to list all the events: `list all events` +
Enter a command to list people in the specific `DEPARTMENT`: `list dep DEPARTMENT`

Example: +
`list dep Admin` +
`list dep Admin Finance`

==== Listing all events: `schedule`

Display the full list of events in the project. +
Expand Down Expand Up @@ -558,7 +593,7 @@ Task with id 1 is submitted as complete.

* *List* : `list`

* *Edit* : `edit LIST_INDEX n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS dep/DEPARTMENT t/TAG…​`
* *Edit* : `edit LIST_INDEX p/PHONE_NUMBER e/EMAIL a/ADDRESS dep/DEPARTMENT t/TAG…​`

* *Delete* : `delete LIST_INDEX`

Expand All @@ -567,9 +602,9 @@ Task with id 1 is submitted as complete.

* *Schedule* : `schedule`

* *Invite* : `invite LIST_INDEX to/SCHEDULE_INDEX`
* *Invite* : `invite PERSON_INDEX to/EVENT_INDEX`

* *Remove* : `remove SCHEDULE_INDEX n/NAME`
* *Remove* : `remove PERSON_INDEX n/EVENT_INDEX`

* *editEvent* : `n/NAME d/DESCRIPTION l/LOCATION date/DATE s/START TIME e/END TIME `

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/address/MainApp.java
Expand Up @@ -10,7 +10,6 @@
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;

import seedu.address.commons.core.Config;
import seedu.address.commons.core.EventsCenter;
import seedu.address.commons.core.LogsCenter;
Expand Down Expand Up @@ -47,7 +46,7 @@
*/
public class MainApp extends Application {

public static final Version VERSION = new Version(1, 1, 0, true);
public static final Version VERSION = new Version(1, 2, 1, true);

private static final Logger logger = LogsCenter.getLogger(MainApp.class);

Expand All @@ -69,7 +68,6 @@ public void init() throws Exception {

UserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(config.getUserPrefsFilePath());
userPrefs = initPrefs(userPrefsStorage);
//TODO: Convert addressbookstorage to person storage
AddressBookStorage addressBookStorage = new XmlAddressBookStorage(userPrefs.getAddressBookFilePath());
EventStorage eventStorage = new XmlEventStorage(userPrefs.getEventlistPath());
storage = new StorageManager(addressBookStorage, eventStorage, userPrefsStorage);
Expand All @@ -83,8 +81,10 @@ public void init() throws Exception {
ui = new UiManager(logic, config, userPrefs);

initEventsCenter();

}


/**
* Returns a {@code ModelManager} with the data from {@code storage}'s address book and {@code userPrefs}. <br>
* The data from the sample address book will be used instead if {@code storage}'s address book is not found,
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/seedu/address/logic/LogicManager.java
Expand Up @@ -8,7 +8,7 @@
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.AddressBookParser;
import seedu.address.logic.parser.ProManageParser;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.Model;
import seedu.address.model.event.Event;
Expand All @@ -22,19 +22,20 @@ public class LogicManager extends ComponentManager implements Logic {

private final Model model;
private final CommandHistory history;
private final AddressBookParser addressBookParser;
private ProManageParser proManageParser;

public LogicManager(Model model) {
this.model = model;
history = new CommandHistory();
addressBookParser = new AddressBookParser();
this.proManageParser = new ProManageParser();
}


@Override
public CommandResult execute(String commandText) throws CommandException, ParseException {
logger.info("----------------[USER COMMAND][" + commandText + "]");
try {
Command command = addressBookParser.parseCommand(commandText);
Command command = proManageParser.parseCommand(commandText);
return command.execute(model, history);
} finally {
history.add(commandText);
Expand Down
Expand Up @@ -40,10 +40,10 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}

// TODO: DELETE EMPLOYEE FROM EVENT ATTENDEE LIST TOO

Person personToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deletePerson(personToDelete);
model.removePersonFromAllEvents(personToDelete);
model.commitAddressBook();
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete));
}
Expand Down
23 changes: 5 additions & 18 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Expand Up @@ -4,7 +4,6 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEPARTMENT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
Expand Down Expand Up @@ -38,9 +37,8 @@ public class EditCommand extends Command {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified "
+ "by the index number used in the displayed person list. "
+ "Existing values will be overwritten by the input values.\n"
+ "Existing values will be overwritten by the input values. Name is NOT editable\n"
+ "Parameters: INDEX (must be a positive integer) "
+ "[" + PREFIX_NAME + "NAME] "
+ "[" + PREFIX_PHONE + "PHONE] "
+ "[" + PREFIX_EMAIL + "EMAIL] "
+ "[" + PREFIX_ADDRESS + "ADDRESS] "
Expand Down Expand Up @@ -99,15 +97,15 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
private static Person createEditedPerson(Person personToEdit, EditPersonDescriptor editPersonDescriptor) {
assert personToEdit != null;

Name updatedName = editPersonDescriptor.getName().orElse(personToEdit.getName());
Name name = personToEdit.getName();
Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone());
Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail());
Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress());
Department updatedDepartment = editPersonDescriptor.getDepartment().orElse(personToEdit.getDepartment());
Set<Tag> updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags());


return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedDepartment, updatedTags);
return new Person(name, updatedPhone, updatedEmail, updatedAddress, updatedDepartment, updatedTags);
}

@Override
Expand All @@ -133,7 +131,6 @@ public boolean equals(Object other) {
* corresponding field value of the person.
*/
public static class EditPersonDescriptor {
private Name name;
private Phone phone;
private Email email;
private Address address;
Expand All @@ -148,7 +145,6 @@ public EditPersonDescriptor() {}
* A defensive copy of {@code tags} is used internally.
*/
public EditPersonDescriptor(EditPersonDescriptor toCopy) {
setName(toCopy.name);
setPhone(toCopy.phone);
setEmail(toCopy.email);
setAddress(toCopy.address);
Expand All @@ -161,15 +157,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) {
* Returns true if at least one field is edited.
*/
public boolean isAnyFieldEdited() {
return CollectionUtil.isAnyNonNull(name, phone, email, address, department, tags);
}

public void setName(Name name) {
this.name = name;
}

public Optional<Name> getName() {
return Optional.ofNullable(name);
return CollectionUtil.isAnyNonNull(phone, email, address, department, tags);
}

public void setPhone(Phone phone) {
Expand Down Expand Up @@ -236,8 +224,7 @@ public boolean equals(Object other) {
// state check
EditPersonDescriptor e = (EditPersonDescriptor) other;

return getName().equals(e.getName())
&& getPhone().equals(e.getPhone())
return getPhone().equals(e.getPhone())
&& getEmail().equals(e.getEmail())
&& getAddress().equals(e.getAddress())
&& getDepartment().equals(e.getDepartment())
Expand Down

0 comments on commit 2a65409

Please sign in to comment.