Skip to content

Commit

Permalink
Merge 291433c into d57e626
Browse files Browse the repository at this point in the history
  • Loading branch information
Happytreat committed Nov 10, 2018
2 parents d57e626 + 291433c commit 6c14e9d
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 21 deletions.
5 changes: 3 additions & 2 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,13 @@ Cons:

The `Group` class extends the `Entity` abstract class just like a `Person` class does. An `Entity` contains an abstract method `isSame` that is necessary for the class to be used in `UniqueList<T extends Entity>`. `Group` class is an immutable class that is contained inside `Model`.

.Class Diagram of Group and Person
image::GroupPersonClassDiagram.png[width="600"]

`Group` features make use of `Storage` to load information on groups added by the user before the UI is closed. `XmlAdaptedGroup` class helps the convert groups detail from xml files to the `AddressBook` when `MainApp` starts and similarly convert `Group` objects into xml files.

`Group` features also updates the Group Panel inside the `UI` using a predicate.

[MelodiesTODO: Add diagram showing how Group class interacts with Storage, UI, Model and Logic]

==== Current Implementation
The current group commands added are:

Expand Down
Binary file not shown.
Binary file modified docs/diagrams/HighLevelSequenceDiagrams.pptx
100644 → 100755
Binary file not shown.
Binary file removed docs/diagrams/LogicComponentClassDiagram.pptx
Binary file not shown.
Binary file not shown.
Binary file added docs/images/GroupPersonClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions docs/team/happytreat.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ i.e. add_group, delete_group, edit_group, register, delete_member, find_group, v

* *Minor enhancement*: Enhance `list` command to list both groups and persons. Added a `list INDEX` command to show all the groups that the person at INDEX is currently in.

* *Minor enhancement*: Created short hands/short forms for most commands.
* *Minor enhancement*: Created short hands/short forms for most commands. (https://github.com/CS2103-AY1819S1-F11-4/main/pull/208[#208])

* *Minor enhancement*: Refactored UniquePersonList into UniqueList<T> for different classes: Groups, Person and Timetable.

Expand All @@ -46,11 +46,12 @@ i.e. add_group, delete_group, edit_group, register, delete_member, find_group, v
** Enhancements to existing features:
*** Wrote additional tests for existing features to increase coverage by >4% (Pull requests https://github.com/CS2103-AY1819S1-F11-4/main/pull/80[#80], https://github.com/CS2103-AY1819S1-F11-4/main/pull/123[#123], https://github.com/CS2103-AY1819S1-F11-4/main/pull/146[#146])
** Documentation:
*** Edit the Model OOP Class Diagram in Dev Guide to include Group classes: https://github.com/CS2103-AY1819S1-F11-4/main/pull/202[#202]
*** Edit the Storage Class Diagram in Dev Guide to include Group class: https://github.com/CS2103-AY1819S1-F11-4/main/pull/200[#200]
*** Edit the Model OOP Class Diagram in Dev Guide to include new classes: https://github.com/CS2103-AY1819S1-F11-4/main/pull/202[#202]
*** Edit the Storage Class Diagram in Dev Guide to include new class: https://github.com/CS2103-AY1819S1-F11-4/main/pull/200[#200]
*** Update Logic and High Level Sequence Diagrams to current implementation https://github.com/CS2103-AY1819S1-F11-4/main/pull/213[#213]
** Community:
*** PRs reviewed (with non-trivial review comments): https://github.com/CS2103-AY1819S1-F11-4/main/pull/71[#71])
*** Some parts of the group feature I added was adopted by several other teammates (https://github.com/CS2103-AY1819S1-F11-4/main/pull/160[#160])
*** Some parts of the group feature I added was adopted by several other teammates (https://github.com/CS2103-AY1819S1-F11-4/main/pull/155[#155], https://github.com/CS2103-AY1819S1-F11-4/main/pull/160[#160])
*** Create a CommandUtil.java with many common functions reused by different commands including those in AB4 and those used by other teammates.

== Contributions to the User Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import seedu.address.model.person.Name;

/**
* Lists all time slots in descending order in terms of availablility with
* a minimum number of people available required
* Lists all time slots in descending order in terms of availablility with a minimum number of people available
* required
*/
public class ViewGroupRankedAvailableTimeslotCommand extends Command {

Expand Down Expand Up @@ -51,8 +51,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
Group group = CommandUtil.retrieveGroupFromName(model, groupName);

model.updateFilteredGroupList(PREDICATE_SHOW_ALL_GROUPS);
return new CommandResult(MESSAGE_SUCCESS + this.numberRequired + " person(s) available:\n" +
group.listRankedAvailableTimeslots(numberRequired));
return new CommandResult(MESSAGE_SUCCESS + this.numberRequired + " person(s) available:\n"
+ group.listRankedAvailableTimeslots(numberRequired));
}

}
21 changes: 11 additions & 10 deletions src/main/java/seedu/address/model/group/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ private String dayToString(int day) {
* in ascending order in terms of timing
*/
public String listAllAvailableTimeslots() {
int numOfPeople = groupMembers.getSize();
if (numOfPeople == 0) {
return "There are no members in the group";
}
int numOfPeople = groupMembers.getSize();
if (numOfPeople == 0) {
return "There are no members in the group";
}

Iterator<Person> personItr = groupMembers.iterator();
StringBuilder builder = new StringBuilder();
TreeSet<Integer> availableSlots = new TreeSet<>();
Expand Down Expand Up @@ -152,7 +153,7 @@ public String listAllAvailableTimeslots() {
}
}
if (availableSlots.size() == 0) {
return "There are no available slots";
return "There are no available slots";
}
Iterator<Integer> slotsItr = availableSlots.iterator();
while (slotsItr.hasNext()) {
Expand All @@ -171,10 +172,10 @@ public String listAllAvailableTimeslots() {
* minimum number of people required to be available
*/
public String listRankedAvailableTimeslots(int numberRequired) {
int numOfPeople = groupMembers.getSize();
if (numOfPeople == 0) {
return "There are no members in the group";
}
int numOfPeople = groupMembers.getSize();
if (numOfPeople == 0) {
return "There are no members in the group";
}
Iterator<Person> personItr = groupMembers.iterator();
StringBuilder builder = new StringBuilder();
TreeMap<Integer, Integer> availableSlots = new TreeMap<>();
Expand All @@ -196,7 +197,7 @@ public String listRankedAvailableTimeslots(int numberRequired) {
}
}
if (availableSlots.size() == 0) {
return "There are no available slots";
return "There are no available slots";
}
Map<Integer, Integer> sortedSlots = availableSlots.entrySet().stream()
.sorted(Collections.reverseOrder
Expand Down

0 comments on commit 6c14e9d

Please sign in to comment.