diff --git a/src/main/java/seedu/address/logic/commands/cca/CcaEnrolCommand.java b/src/main/java/seedu/address/logic/commands/cca/CcaEnrolCommand.java index abe8554dd0a..ee225936f93 100644 --- a/src/main/java/seedu/address/logic/commands/cca/CcaEnrolCommand.java +++ b/src/main/java/seedu/address/logic/commands/cca/CcaEnrolCommand.java @@ -72,6 +72,8 @@ public CommandResult execute(Model model) throws CommandException { boolean success = model.enrolPersonIntoCca(ccaToEnrolInto, personToEnrol); if (success) { + model.setCca(ccaToEnrolInto, ccaToEnrolInto); + model.updateFilteredCcaList(Model.PREDICATE_SHOW_ALL_CCAS); return new CommandResult(String.format(MESSAGE_SUCCESS, personToEnrol.getName(), ccaToEnrolInto.getName())); } else { throw new CommandException( diff --git a/src/main/java/seedu/address/logic/commands/cca/CcaExpelCommand.java b/src/main/java/seedu/address/logic/commands/cca/CcaExpelCommand.java index 83aff504a81..ccfc0c28ee4 100644 --- a/src/main/java/seedu/address/logic/commands/cca/CcaExpelCommand.java +++ b/src/main/java/seedu/address/logic/commands/cca/CcaExpelCommand.java @@ -16,6 +16,7 @@ import seedu.address.model.person.Person; public class CcaExpelCommand extends Command { + public static final String COMMAND_WORD = "expel"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": Expels a person from a CCA. " @@ -71,6 +72,8 @@ public CommandResult execute(Model model) throws CommandException { boolean success = model.expelPersonFromCca(ccaToExpelFrom, personToExpel); if (success) { + model.setCca(ccaToExpelFrom, ccaToExpelFrom); + model.updateFilteredCcaList(Model.PREDICATE_SHOW_ALL_CCAS); return new CommandResult(String.format(MESSAGE_SUCCESS, personToExpel.getName(), ccaToExpelFrom.getName())); } else { throw new CommandException( diff --git a/src/main/java/seedu/address/model/cca/Cca.java b/src/main/java/seedu/address/model/cca/Cca.java index e6e2dca4119..c2048e873b8 100644 --- a/src/main/java/seedu/address/model/cca/Cca.java +++ b/src/main/java/seedu/address/model/cca/Cca.java @@ -49,6 +49,14 @@ public Set getPersonArrayList() { return personArrayList; } + /** + * Returns the number of people in this CCA. + * @return the number of members of this CCA + */ + public int getNumberOfMembers() { + return personArrayList.size(); + } + /** * Returns the cid of this CCA. * @return the cid of this CCA diff --git a/src/main/java/seedu/address/ui/CcaCard.java b/src/main/java/seedu/address/ui/CcaCard.java index 6a855ff2adf..0987c001c78 100644 --- a/src/main/java/seedu/address/ui/CcaCard.java +++ b/src/main/java/seedu/address/ui/CcaCard.java @@ -49,7 +49,7 @@ public CcaCard(Cca cca, int displayedIndex) { this.cca = cca; id.setText(displayedIndex + ". "); this.name.setText(cca.getName().fullName); - this.numPeople.setText("No. of people: 3"); + this.numPeople.setText("No. of people: " + cca.getNumberOfMembers()); // can consider having tags for CCAs Label tempLabel = new Label("Music"); diff --git a/src/main/java/seedu/address/ui/CcaListPanel.java b/src/main/java/seedu/address/ui/CcaListPanel.java index 35e459df550..80b294c2777 100644 --- a/src/main/java/seedu/address/ui/CcaListPanel.java +++ b/src/main/java/seedu/address/ui/CcaListPanel.java @@ -10,6 +10,9 @@ import seedu.address.commons.core.LogsCenter; import seedu.address.model.cca.Cca; +/** + * Panel containing the list of CCAs. + */ public class CcaListPanel extends UiPart { private static final String FXML = "CcaListPanel.fxml"; private final Logger logger = LogsCenter.getLogger(CcaListPanel.class);