forked from nusCS2113-AY1819S1/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
212 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
= Chia Xiang Rong - Project Portfolio | ||
:site-section: AboutUs | ||
:imagesDir: ../images | ||
:stylesDir: ../stylesheets | ||
|
||
== PROJECT: Event Manager | ||
|
||
--- | ||
|
||
== Overview | ||
|
||
Event Manager is a desktop address book application used for managing events in the Halls and Residential Colleges of NUS. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. | ||
|
||
== Summary of contributions | ||
* *Major enhancement*: Added *the ability to register/unregister for events and view event attendance* | ||
** What it does: Allows users to indicate their attendance for events, and view the usernames of other attendees. | ||
** Justification: This feature allows event ICs to have an idea of the number of attendees for planning purposes, as well as users to see who else is attending the event so they might connect with people they know. | ||
** Highlights: This enhancement affects existing commands and commands to be added in the future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. | ||
** Credits: - | ||
|
||
* *Minor enhancement*: Created EventSearchPage to display all event details on selection. | ||
|
||
* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] | ||
|
||
* *Other contributions*: | ||
|
||
** Project management: | ||
*** Managed releases `v1.3` - `v1.4` (2 releases) on GitHub | ||
*** Wrote additional tests for RSVP features to increase coverage (Pull request https://github.com/CS2113-AY1819S1-T12-1/main/pull/99[#99]) | ||
** Documentation: | ||
*** Updated User and Developer Guides to describe new features: https://github.com/CS2113-AY1819S1-T12-1/main/pull/81[#81] | ||
** Community: | ||
*** PRs reviewed: https://github.com/CS2113-AY1819S1-T12-1/main/pull/22[#22], https://github.com/CS2113-AY1819S1-T12-1/main/pull/58[#58], https://github.com/CS2113-AY1819S1-T12-1/main/pull/59[#59] | ||
** Tools: - | ||
|
||
== Contributions to the User Guide | ||
|
||
|
||
|=== | ||
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ | ||
|=== | ||
|
||
include::../UserGuide.adoc[tag=rsvp] | ||
|
||
|
||
== Contributions to the Developer Guide | ||
|
||
|=== | ||
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ | ||
|=== | ||
|
||
include::../DeveloperGuide.adoc[tag=rsvp] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/main/java/seedu/address/logic/commands/UnregisterCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.commands.EditCommand.EditEventDescriptor; | ||
import static seedu.address.logic.commands.EditCommand.createEditedEvent; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_EVENTS; | ||
|
||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import seedu.address.commons.core.EventsCenter; | ||
import seedu.address.commons.core.Messages; | ||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.commons.events.ui.JumpToListRequestEvent; | ||
import seedu.address.logic.CommandHistory; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.attendee.Attendee; | ||
import seedu.address.model.event.Event; | ||
|
||
/** | ||
* Unregisters for an event identified using it's displayed index from the event manager. | ||
*/ | ||
public class UnregisterCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "unregister"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Unregisters for an event identified by the index number used in the displayed event list.\n" | ||
+ "Parameters: INDEX (must be a positive integer)\n" | ||
+ "Example: " + COMMAND_WORD + " 1"; | ||
|
||
public static final String MESSAGE_UNREGISTER_EVENT_SUCCESS = "Unregistered for event: %1$s"; | ||
public static final String MESSAGE_NOT_REGISTERED = "Not registered for event."; | ||
|
||
private final Index targetIndex; | ||
|
||
public UnregisterCommand(Index targetIndex) { | ||
this.targetIndex = targetIndex; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model, CommandHistory history) throws CommandException { | ||
requireNonNull(model); | ||
|
||
List<Event> filteredEventList = model.getFilteredEventList(); | ||
|
||
if (targetIndex.getZeroBased() >= filteredEventList.size()) { | ||
throw new CommandException(Messages.MESSAGE_INVALID_EVENT_DISPLAYED_INDEX); | ||
} | ||
|
||
Event eventToUnregister = filteredEventList.get(targetIndex.getZeroBased()); | ||
|
||
String attendeeName = model.getUsername().toString(); | ||
|
||
Set<Attendee> attendeeSet = new HashSet<>(eventToUnregister.getAttendance()); | ||
|
||
if (!attendeeSet.remove(new Attendee(attendeeName))) { | ||
throw new CommandException(MESSAGE_NOT_REGISTERED); | ||
} | ||
|
||
EditEventDescriptor registerEventDescriptor = new EditEventDescriptor(); | ||
registerEventDescriptor.setAttendees(attendeeSet); | ||
Event registeredEvent = createEditedEvent(eventToUnregister, registerEventDescriptor); | ||
|
||
model.updateEvent(eventToUnregister, registeredEvent); | ||
model.updateFilteredEventList(PREDICATE_SHOW_ALL_EVENTS); | ||
model.commitEventManager(); | ||
|
||
EventsCenter.getInstance().post(new JumpToListRequestEvent(targetIndex)); | ||
return new CommandResult(String.format(MESSAGE_UNREGISTER_EVENT_SUCCESS, targetIndex.getOneBased())); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof UnregisterCommand // instanceof handles nulls | ||
&& targetIndex.equals(((UnregisterCommand) other).targetIndex)); // state check | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/seedu/address/logic/parser/UnregisterCommandParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package seedu.address.logic.parser; | ||
|
||
import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
|
||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.commands.UnregisterCommand; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
|
||
/** | ||
* Parses input arguments and creates a new RegisterCommand object | ||
*/ | ||
public class UnregisterCommandParser implements Parser<UnregisterCommand> { | ||
|
||
/** | ||
* Parses the given {@code String} of arguments in the context of the RegisterCommand | ||
* and returns an RegisterCommand object for execution. | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public UnregisterCommand parse(String args) throws ParseException { | ||
try { | ||
Index index = ParserUtil.parseIndex(args); | ||
return new UnregisterCommand(index); | ||
} catch (ParseException pe) { | ||
throw new ParseException( | ||
String.format(MESSAGE_INVALID_COMMAND_FORMAT, UnregisterCommand.MESSAGE_USAGE), pe); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters