Yue Yang's Project Portfolio Page
Project: GreenMileageEfforts
Overview
GreenMileageEfforts (GME) is a platform that helps the HR executive of any company quickly arrange carpooling among its employees in order to lower the carbon footprint of the company.
Given below are my contributions to the project.
-
New Feature: Added the ability to find by more parameters. (PR #110, #122)
- What it does: allows the user to find passengers by other parameters not limited to name.
- Justification: This is allows users to find passengers more quickly.
-
Code contributed: RepoSense link
-
Enhancements to existing features:
- Allow for multiple deletion of passengers. (PR #133)
- Renamed addressbook.json to GMEdata.json. (PR #133)
- Provide warning when time difference of pool and any of passenger is more than 15 minutes. (PR #145)
-
Contributions to UG:
- Add explanations for the behaviour of Find command.
- Add explanations for the multi-delete enhancement of Delete command.
- Added more examples for the command summary for Find and Delete.
- Correcting other minor mistakes made such as the lack of full stops.
- Suggested the grouping of features according to Passenger-oriented and Pool-oriented commands later implemented by Zech.
-
Contributions to DG:
- Add rationale, sequence diagram and explanation for Find command.
- Created sequence diagram for older iteration of Delete command.
- Added manual tests for Find and Delete.
- Correct other minor mistakes made such as the inconsistent lack of full stops.
- Added explanation for the effort section.
- Contributions to the team:
UG Contributions
Explanation for Find Command:
Finds passengers whose names contain any of the given keywords.
Format: find PREFIX/KEYWORD
where PREFIX is one of the following: n
, a
, p
, tag
, pr
, all
, d
, t
Notes about the find command:
- Only full words will be matched e.g.
Han
will not matchHans
. - Only one type of prefix can be specified.
- More than 1 keyword can be specified for a single prefix.
- Keywords separated by space will require both keywords to be matched in whole and cannot be broken apart.
e.g.
Hans Yang
will only returnGruber Hans Yang
instead ofBo Yang
andHans Gruber Yang
. - Prefixes for searching name
n/
, addressa/
, tagtag/
, phone numberp/
, pricepr/
, dayd/
and timet/
. - Searching with prefixes such as
n/
anda/
which are anticipated to have multiple words separated by spaces will have multiple spaces shortened to one. Refer to 4th example for clarification. -
all
prefix for searching across names, addresses, tags and phone numbers quickly. - However, if any or all of the words are invalid arguments, searching with
all
will not tell you it is invalid. It will only show that no passengers with those arguments are found.
Examples:
-
find a/serangoon
returnsBernice Yu
,David Li
.
-
find d/Monday d/Tuesday
returnsAlex Yeoh
,Irfan Ibrahim
andRoy Balakrishnan
. -
find n/Alex Yeoh
with multiple spaces between Alex and Yeoh
Explanation for Delete Command:
- Multiple passengers can be deleted by including additional indexes after the first.
- The index refers to the index number shown in the displayed passenger list.
- The index must be a positive integer 1, 2, 3, …
-
search female
followed bydelete 3
deletes the 1st passenger in the results ofsearch female
command. - Passengers with a carpool arrangement cannot be deleted,
unpool
must first be done on the pools they are in before deletion.
</div>
Examples:
-
list
followed bydelete 3
deletes the 3rd person in the passenger list. -
delete 1 2 5
deletes the 1st, 2nd and 5th person in the passenger list.
Additional examples for command summary
-
find find a/ADDRESS [a/ADDRESS a/ADDRESS ...]
orfind n/NAME [n/NAME n/NAME ...]
orfind p/PHONE NUMBER [p/PHONE NUMBER p/PHONE NUMBER ...]
orfind tag/TAG [tag/TAG tag/TAG ...]
orfind all/KEYWORD [all/KEYWORD all/KEYWORD ...]
orfind d/DAY [d/DAY d/DAY ...]
orfind t/TIME [t/TIME t/TIME ...]
e.g.,find tag/female
-
delete delete INDEX [INDEX INDEX...]
e.g.delete 1 3
DG Contributions
Explanation for Find Command
The rationale behind expanding on the find feature is to allow for the user to find passengers by more attributes to improve usability. Instead of being restricted to searching for names only, the user can now find other passengers with the same day or of a certain area. This is vital as it is necessary to improve the usability for the user when attempting to find passengers to carpool with drivers.
command
argument that is passed into
execute()
, represents the string "find n/Lucy n/Adam"
, and has been abstracted for readability.
The lifeline for
FindCommandParser
should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
From the diagram illustrated above:
-
LogicManager
has itsexecute()
method called when a user enters the"find n/Lucy n/Adam"
command. - Object of
AddressBookParser
class is then accessed, which then subsequently createsFindCommandParser
class object to help parse the user’s command. -
AddressBookParser
would then invoke theparse()
method ofFindCommandParser
, with parametersn/Lucy n/Adam
, to parse the argumentsn/Lucy n/Adam
. -
FindCommandParser
parses the argumentsn/Lucy n/Adam
and creates aNameContainsKeywordPredicate
object namedpredicate
which is returned to theFindCommandParser
object. -
FindCommandParser
then instantiates aFindCommand
object withpredicate
as a parameter. TheFindCommand
object is then returned toLogicManager
. -
LogicManager
would subsequently invoke theexecute()
method ofFindCommand
, which in turn calls theupdateFilteredPoolList()
method inModel
, causing the shown pool list to be updated according topredicate
in theFindCommand
object. - A
CommandResult
object is then created with a message which includes the number of passengers found on the list updated byupdateFilteredPoolList()
. - Finally, the
CommandResult
object is returned toLogicManager
.
Old Delete Sequence Diagram
Manual testing
Deleting a passenger
-
Deleting a passenger while all passengers are being shown.
-
Prerequisites: List all passengers using the
list
command. Multiple passengers in the list. Passengers to be deleted are not in a pool. -
Test case:
delete 1
.
Expected: First contact is deleted from the list. Name of the deleted contact shown in the status message. -
Test case:
delete 0
.
Expected: No passenger is deleted. Error details shown in the status message. Text in command bar turns red. -
Other incorrect delete commands to try:
delete
,delete x
,...
(where x is larger than the list size).
Expected: Similar to previous.
-
-
Deleting multiple passengers while all passengers are being shown.
-
Prerequisites: List all passengers using the
list
command. Multiple passengers in the list. Passengers to be deleted are not in a pool. -
Test case:
delete 1 2
.
Expected: First and second contact is deleted from the list. Names of deleted contacts are shown in the status message.
-
Finding a passenger
-
Finding passengers by name while all passengers shown.
-
Prerequisites: Newly generated sample data is used. This can be done by deleting
data/GMEdata.json
. All passengers listed usinglist
. -
Test case:
find n/bernice
.
Expected: Details of passenger namedBernice Yu
is shown. Status message shows 1 passenger listed. -
Test case:
find n/bob
.
Expected: No passengers are shown. Status message shows 0 passenger listed. -
Test case:
find n/ROY n/lEnny
.
Expected: Details of passengers namedRoy Balakrishnan
andLenny Hoon
shown. Status message shows 2 passengers listed. -
Test case:
find n/ David lI
.
Expected: Details of passenger namedDavid Li
is shown. Status message shows 1 passenger listed.
-
-
Finding passengers by tag while all passengers are shown.
-
Prerequisites: Newly generated sample data is used. This can be done by deleting
data/GMEdata.json
. All passengers listed usinglist
. -
Test case:
find tag/finance
.
Expected: Details ofBernice Yu
andRoy Balakrishnan
are shown. Status message shows 2 passengers listed. -
Test case:
find tag/marketing tag/sales
.
Expected: Details ofAlex Yeoh
,Bernice Yu
,Irfan Ibrahim
andTurner Peck
are shown. Status message shows 4 passengers listed. -
Test case:
find tag/marketing sales
.
Expected: Passengers are shown are same as previous. Status message shows tag provided is invalid.
-
Effort appendix
Extension of find
command
The initial implementation of find
inherited from AB3 only allowed users to search by names.
To improve usability for users, we introduced searching of other fields of a passenger.
While implementing the first iteration in v1.2, it took some additional time as it took some time to understand which classes interacted with each other when find
was executed.
This was harder to understand as there was no sequence diagram included for the find
command as well.
To implement the command, a predicate was needed for each of the attributes as well as the parsing of the arguments in FindCommandParser
to allow for different type of searches to be possible.
Extension of delete
command
The initial implementation of delete
inherited from AB3 only allowed users to delete 1 passenger at a time.
To improve usability for users, we introduced multi-passenger deletion using indexes.
The first iteration of this allowed for passengers to be deleted despite some other passengers being already in a pool.
This was later revised to prevent users from executing delete
all together when there are passengers still in a pool.
This was chosen as better code quality could be achieved through such a decision.