Skip to content

Commit

Permalink
Merge pull request #273 from AY2324S1-CS2103T-T10-3/Branch-v1.4
Browse files Browse the repository at this point in the history
Updated Branch v1.4 to master
  • Loading branch information
lerxuann authored Nov 13, 2023
2 parents dc89db6 + 599893e commit 0a0c718
Show file tree
Hide file tree
Showing 16 changed files with 602 additions and 272 deletions.
320 changes: 212 additions & 108 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

299 changes: 197 additions & 102 deletions docs/UserGuide.md

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/diagrams/DeleteCommandActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ start
:User wants to delete a group or contact;
:User runs the "delete" command;
if () then ([Invalid command format])
:ProjectPro throws an error;
:ProjectPRO throws an error;
else (["delete g/GROUPNAME" or "delete n/NAME"])
:ProjectPRO checks if User is deleting a group or contact;
if () then (["delete g/GROUPNAME"])
Expand Down
16 changes: 1 addition & 15 deletions docs/diagrams/DeleteGroupSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant "CS2100:Group" as Group MODEL_COLOR
participant "p:Person" as Person MODEL_COLOR
end box

[-> LogicManager : execute("delete g/CS2100")
Expand Down Expand Up @@ -54,21 +52,9 @@ activate DeleteGroupCommand
DeleteGroupCommand -> Model : deleteGroup("CS2100")
activate Model

Model --> DeleteGroupCommand : CS2100
Model --> DeleteGroupCommand
deactivate Model

DeleteGroupCommand -> Group : getListOfGroupMates()
activate Group

Group --> DeleteGroupCommand
deactivate Group

DeleteGroupCommand -> Person : removeGroup(CS2100)
activate Person

Person --> DeleteGroupCommand
deactivate Person

create CommandResult
DeleteGroupCommand -> CommandResult
activate CommandResult
Expand Down
70 changes: 70 additions & 0 deletions docs/diagrams/FindPersonSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":FindCommandParser" as FindCommandParser LOGIC_COLOR
participant "d:FindPersonCommand" as FindPersonCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("find n/Alex John")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("find n/Alex John")
activate AddressBookParser

create FindCommandParser
AddressBookParser -> FindCommandParser
activate FindCommandParser

FindCommandParser --> AddressBookParser
deactivate FindCommandParser

AddressBookParser -> FindCommandParser : parse("n/Alex John")
activate FindCommandParser

create FindPersonCommand
FindCommandParser -> FindPersonCommand
activate FindPersonCommand

FindPersonCommand --> FindCommandParser : d
deactivate FindPersonCommand

FindCommandParser --> AddressBookParser : d
deactivate FindCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
FindCommandParser -[hidden]-> AddressBookParser
destroy FindCommandParser

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> FindPersonCommand : execute()
activate FindPersonCommand

FindPersonCommand -> Model : updateFilteredPersonList(NameContainsKeywordsPredicate)
activate Model

Model --> FindPersonCommand
deactivate Model

create CommandResult
FindPersonCommand -> CommandResult
activate CommandResult

CommandResult --> FindPersonCommand
deactivate CommandResult

FindPersonCommand --> LogicManager : result
deactivate FindPersonCommand

[<--LogicManager
deactivate LogicManager
@enduml
72 changes: 72 additions & 0 deletions docs/diagrams/ListGroupSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":ListGroupCommandParser" as ListGroupCommandParser LOGIC_COLOR
participant "c:ListGroupCommand" as ListGroupCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box


[-> LogicManager : execute("listgroup")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("listgroup")
activate AddressBookParser

create ListGroupCommandParser
AddressBookParser -> ListGroupCommandParser
activate ListGroupCommandParser

ListGroupCommandParser --> AddressBookParser
deactivate ListGroupCommandParser

AddressBookParser -> ListGroupCommandParser : parse("listgroup")
activate ListGroupCommandParser

create ListGroupCommand
ListGroupCommandParser -> ListGroupCommand
activate ListGroupCommand

ListGroupCommand --> ListGroupCommandParser : c
deactivate ListGroupCommand

ListGroupCommandParser --> AddressBookParser : c
deactivate ListGroupCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
ListGroupCommandParser -[hidden]-> AddressBookParser
destroy ListGroupCommandParser

AddressBookParser --> LogicManager : c
deactivate AddressBookParser

LogicManager -> ListGroupCommand : execute()
activate ListGroupCommand

ListGroupCommand -> Model : getFilteredGroupList()
activate Model

Model --> ListGroupCommand
deactivate Model

create CommandResult
ListGroupCommand -> CommandResult
activate CommandResult

CommandResult --> ListGroupCommand
deactivate CommandResult

ListGroupCommand --> LogicManager : result
deactivate ListGroupCommand

[<--LogicManager
deactivate LogicManager

@enduml
29 changes: 29 additions & 0 deletions docs/diagrams/ListTimeActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
'https://plantuml.com/activity-diagram-beta

start
:User wants to list the times of a group or contact;
:User runs the "listtime" command;
if () then ([Invalid command format])
:ProjectPRO throws an error;
else (["listtime g/GROUPNAME" or "listtime n/NAME"])
:ProjectPRO checks if User is listing time of a group or contact;
if () then (["listtime g/GROUPNAME"])
:ProjectPRO checks if group exists;
if () then ([Group exists])
: ProjectPRO lists times of specified group;
else([Else])
: ProjectPRO throws an error;
endif
else(["listtime n/NAME"])
: ProjectPRO checks if contact exists;
if () then ([Contact exists])
: ProjectPRO lists times of specified contact;
else([Else])
: ProjectPRO throws an error;
endif
endif
endif
stop

@enduml
4 changes: 2 additions & 2 deletions docs/team/coderhuang559.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Given below are my contributions to the project.

* **Documentation**:
* User Guide:
* Added documentation for the features `remark` for contacts, `listtime` for contacts, `addmeeting` for groups and `deletetime` for groups. [\#145](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/145)
* Added documentation for the features `remark` for contacts, `listtime` for contacts, `addmeeting` for groups and `deletetime` for groups. [\#144](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/145)
* Developer Guide:
* Added implementation details of the `remark` [\#112](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/112/files) and `addgroup` [\#226](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/226/files) feature.
* Added implementation details of the `remark` [\#112](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/112/files), `listtime` [\#226](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/226/files), and `addmeeting` features.
* Added activity and sequence diagrams for the above functions. This includes for delete person time command, shown here.
* <puml src="diagrams/GroupRemarkSequenceDiagram.puml" alt="GroupRemarkSequenceDiagram"/>

Expand Down
18 changes: 1 addition & 17 deletions docs/team/lerxuann.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,7 @@ Given below are my contributions to the project.
* Added documentation for the features `add contact` and `delete contact`. [\#147](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/147)
* Resolved inconsistencies in existing documentation in multiple features, including `delete contact`, `find contact` and `list`: [\#228](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/228)
* Developer Guide:
* Added implementation details of the `delete contact` and `delete group` features. [\#116](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/116)

[//]: # (* **Community**:)

[//]: # ( * PRs reviewed &#40;with non-trivial review comments&#41;: [\#12]&#40;&#41;, [\#32]&#40;&#41;, [\#19]&#40;&#41;, [\#42]&#40;&#41;)

[//]: # ( * Contributed to forum discussions &#40;examples: [1]&#40;&#41;, [2]&#40;&#41;, [3]&#40;&#41;, [4]&#40;&#41;&#41;)

[//]: # ( * Reported bugs and suggestions for other teams in the class &#40;examples: [1]&#40;&#41;, [2]&#40;&#41;, [3]&#40;&#41;&#41;)

[//]: # ( * Some parts of the history feature I added was adopted by several other class mates &#40;[1]&#40;&#41;, [2]&#40;&#41;&#41;)

[//]: # (* **Tools**:)

[//]: # ( * Integrated a third party library &#40;Natty&#41; to the project &#40;[\#42]&#40;&#41;&#41;)

[//]: # ( * Integrated a new Github plugin &#40;CircleCI&#41; to the team repo)
* Added implementation details of the `delete`, `find`, `list` [\#265](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/265) and `listgroup` [\#268](https://github.com/AY2324S1-CS2103T-T10-3/tp/pull/268) features.

* **Contributions beyond project team**
* Meticulously reviewed other groups' works and provided feedback on potential bugs [here](https://github.com/lerxuann/ped).
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/seedu/address/logic/commands/DeleteGroupCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import static java.util.Objects.requireNonNull;

import javafx.collections.ObservableList;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.group.Group;
import seedu.address.model.person.Person;

/**
* Removes group from the addressbook and person.
Expand All @@ -25,16 +23,6 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
Group groupToDelete = model.deleteGroup(this.groupName);

//Delete group from all People
ObservableList<Person> groupMates = groupToDelete.getListOfGroupMates();
groupMates.stream().forEach(p -> {
try {
p.removeGroup(groupToDelete);
} catch (CommandException e) {
throw new RuntimeException();
}
});

return new CommandResult(String.format(MESSAGE_DELETE_GROUP_SUCCESS, groupToDelete.getGroupName()));
}

Expand Down
19 changes: 8 additions & 11 deletions src/main/java/seedu/address/model/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,6 @@ public void removePerson(Person key) {
});
}

/**
* Adds a person to a group
* @param person person to add
* @param group group to add person to
*/
public void addPersonToGroup(Person person, Group group) {
requireNonNull(person);
requireNonNull(group);
GroupList groups = person.getGroups();
}

public Person getPerson(String personName) throws CommandException {
// person list get that person object with same name
return persons.getPerson(personName);
Expand Down Expand Up @@ -168,6 +157,14 @@ public void addGroup(Group g) {
*/
public void removeGroup(Group g) {
groups.remove(g);

g.toStream().forEach(p -> {
try {
p.removeGroup(g);
} catch (CommandException e) {
throw new RuntimeException();
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ public Group deleteGroup(String groupName) throws CommandException {
for (Group group : groups) {
if (group.getGroupName().equals(groupName)) {
groups.remove(group);
persons.forEach(p -> {
try {
p.removeGroup(group);
} catch (CommandException e) {
throw new RuntimeException(e);
}
});
return group;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private class ModelStubWithGroup extends ModelStub {

ModelStubWithGroup() {
this.personsAdded = TypicalPersons.getTypicalPersons();
this.groupsAdded = TypicalGroups.getTypicalPGroup();
this.groupsAdded = TypicalGroups.getTypicalGroupList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalPersons.ALICE;
import static seedu.address.testutil.TypicalPersons.HOON;
import static seedu.address.testutil.TypicalPersons.IDA;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;
Expand Down Expand Up @@ -73,7 +72,6 @@ public void readAndSaveAddressBook_allInOrder_success() throws Exception {

// Modify data, overwrite exiting file, and read back
original.addPerson(HOON);
original.removePerson(ALICE);
jsonAddressBookStorage.saveAddressBook(original, filePath);
readBack = jsonAddressBookStorage.readAddressBook(filePath).get();
assertEquals(original, new AddressBook(readBack));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/seedu/address/testutil/TypicalGroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TypicalGroups {
.withTimeIntervalList("mon 1200 - mon 1400", "wed 1600 - thu 1800")
.build();

public static GroupList getTypicalPGroup() {
public static GroupList getTypicalGroupList() {
GroupList groupList = new GroupList();
Group[] groupArray = {CS2100, CS2102, CS2103, CS2105};
Arrays.stream(groupArray).forEach(groupList::add);
Expand Down

0 comments on commit 0a0c718

Please sign in to comment.