Skip to content

Commit

Permalink
Merge pull request #66 from ketweeen/branch-ListCommand
Browse files Browse the repository at this point in the history
Branch list command
  • Loading branch information
ketweeen committed Oct 20, 2023
2 parents c4b468f + 24091f9 commit 059aa8f
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 90 deletions.
4 changes: 2 additions & 2 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ You can reach us at the email `e0958427[at]comp.nus.edu.sg`

<img src="images/madlamprey.png" width="200px">

[[github](http://github.com/MadLamprey)]
[[github](http://github.com/MadLamprey)]
[[portfolio](team/johndoe.md)]

* Role: Developer
* Responsibilities: Testing
* Responsibilities: Testing
* In charge of: Test cases and coverage


Expand Down
64 changes: 32 additions & 32 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## **Acknowledgements**

This is based on the AddressBook-Level3 project created by the [SE-EDU initiative](https://se-education.org).
This is based on the AddressBook-Level3 project created by the [SE-EDU initiative](https://se-education.org).

_{ list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well }_

Expand Down Expand Up @@ -280,11 +280,11 @@ _{Explain here how the data archiving feature will be implemented}_
* prefers typing to mouse interactions
* is reasonably comfortable using CLI apps

**Value proposition**:
**Value proposition**:

JABPro aims to solve the problem of HR managers having to sort through tons of job applications.
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.

It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc.
It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc.

It serves as a one-stop addressbook for managing job applications.

Expand All @@ -299,7 +299,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
|---------|------------------|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| `* * *` | Hiring Manager | add a candidate's contact information, including name, email, phone number | I can easily access and reach out to candidates when needed |
| `* * *` | Hiring Manager | add notes and comments to candidate profiles to document interview feedback and impressions | I can maintain a record of interactions and feedback |
| `* * *` | Hiring Manager | delete job applicants information | I can remove redundant/unecessary data bloat and also to abide to privacy laws |
| `* * *` | Hiring Manager | delete job applicants information | I can remove redundant/unecessary data bloat and also to abide to privacy laws |
| `* * *` | Hiring Manager | view a specific job applicant's resume or portfolio | I can check whether they meet the requirements requested by other department heads |
| `* * *` | Hiring Manager | search for all job applicants that have a particular skill mentioned in their application | I can find suitable candidates for a project |
| `* * *` | Hiring Manager | List all candidate's information | I can easily view each candidates information |
Expand All @@ -325,79 +325,79 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
**MSS**
1. User requests to add a person.
2. JABPro shows that command has been executed successfully.
3. JABPro adds the person to the list of persons.
3. JABPro adds the person to the list of persons.
Use case ends.

**Extensions**
* 2a. User does not provide the correct information for a person to be added.
* 2a1. JABPro shows an error message and provides course of action for remedy.
* 2a1. JABPro shows an error message and provides course of action for remedy.
Use case resumes at step 1.
* 2b. User has already been added to the list of persons.
* 2b1. JABPro shows an error message and provides course of action for remedy.
* 2b1. JABPro shows an error message and provides course of action for remedy.
Use case resumes at step 1.

**Use case: Add a remark to a person**

**MSS**
1. User requests to add a remark to a person.
2. JABPro shows that command has been executed successfully.
3. JABPro adds the remark to the person.
3. JABPro adds the remark to the person.
Use case ends.

**Extensions**
* 2a. User provides invalid index.
* 2a1. JABPro shows an error message and provides course of action for remedy.
* 2a1. JABPro shows an error message and provides course of action for remedy.
Use case resumes at step 1.
* 2b. User does not provide a remark.
* 2b1. JABPro adds an empty remark to the person, remark no longer seen.
* 2b1. JABPro adds an empty remark to the person, remark no longer seen.
Use case ends.

**Use case: List all persons**

**MSS**
1. User requests to view a list of all persons.
2. JABPro retrieves the list of all persons from the database.
3. JABPro displays the list of all persons to the user.
3. JABPro displays the list of all persons to the user.
4. If the user specifies an attribute to sort by, e.g., "s/name" for sorting by name, the application sorts the list accordingly. If no attribute is provided, the list remains unsorted.
5. The sorted or unsorted list is displayed to the user in ascending order based on the specified attribute.
5. The sorted or unsorted list is displayed to the user in ascending order based on the specified attribute.
Use case ends.

**Extensions**
* 2a. User provides an incorrect attribute for sorting (e.g., "list s/phone").
* 2a1. JABPro shows an error message and provides course of action for remedy.
* 2a1. JABPro shows an error message and provides course of action for remedy.
Use case resumes at step 1.
* 2b. User attempts to list persons when there are no entries in the address book.
* 2b1. JABPro shows a message indicating that there are no persons to display.
* 2b1. JABPro shows a message indicating that there are no persons to display.
Use case ends.

**Use case: Search a person by name**

**MSS**
1. Hiring manager types in name keywords to search users by name.
2. JABPro shows a list of persons whose names contain matching keywords.
2. JABPro shows a list of persons whose names contain matching keywords.
Use case ends.

**Extensions**

* 1a. The given name keyword is invalid (invalid name).
* 1a1. JABPro shows an error message.
* 1a1. JABPro shows an error message.
Use case resumes at step 1.
* 2a. The list is empty.
* 2a. The list is empty.
Use case ends.

**Use case: Search a person by application status**

**MSS**
1. User keys in search command with application status (i.e. interviewed, pending, rejected, offered).
2. JABPro shows a list of persons whose status match the given status keywords.
2. JABPro shows a list of persons whose status match the given status keywords.
Use case ends.

**Extensions**

* 1a. The given name status is invalid (not from the given list of valid status keywords).
* 1a1. JABPro shows an error message.
* 1a1. JABPro shows an error message.
Use case resumes at step 1.
* 2a. The list is empty.
* 2a. The list is empty.
Use case ends.


Expand All @@ -407,18 +407,18 @@ Use case ends.
1. User requests to list persons.
2. AddressBook shows a list of persons.
3. User requests to delete a specific person in the list.
4. AddressBook deletes the person.
4. AddressBook deletes the person.
Use case ends.

**Extensions**
* 2a. The list is empty.
* 2a1. AddressBook displays a message indicating that the list is empty.
* 2a1. AddressBook displays a message indicating that the list is empty.
Use case ends.
* 3a. The given index is invalid.
* 3a1. AddressBook shows an error message indicating that the specified index is invalid.
* 3a1. AddressBook shows an error message indicating that the specified index is invalid.
Use case resumes at step 3.
* 4a. Deletion encounters an error
* 4a1. AddressBook displays an error message indicating that the deletion process failed.
* 4a1. AddressBook displays an error message indicating that the deletion process failed.
Use case ends.

**Use case: Set a person's status**
Expand All @@ -427,18 +427,18 @@ Use case ends.
1. User requests to list persons.
2. AddressBook shows a list of persons.
3. User requests to set the status of a specific person in the list.
4. AddressBook sets the status of that person in the list.
4. AddressBook sets the status of that person in the list.
Use case ends.

**Extensions**
* 2a. The list is empty.
* 2a1. AddressBook displays a message indicating that the list is empty.
* 2a1. AddressBook displays a message indicating that the list is empty.
Use case ends.
* 3a. The given index is invalid.
* 3a1. AddressBook shows an error message indicating that the specified index is invalid.
* 3a1. AddressBook shows an error message indicating that the specified index is invalid.
Use case resumes at step 3.
* 3b. The given status is invalid.
* 3b1. AddressBook shows an error message indicating that the specified status is invalid.
* 3b1. AddressBook shows an error message indicating that the specified status is invalid.
Use case resumes at step 3.

**Use case: Add social profile to person's details**
Expand Down Expand Up @@ -486,9 +486,9 @@ Use case ends.
5. Should not deal with `external database` or `network connections`.
6. Product is expected to be used by a `single user` only.
7. Product is `not expected to contain API` for other software to communicate with.
8. Product is expected to be used in a system with at least 4GB RAM and `1GB free disk space`.
9. Product Visuals should be `unambiguous` and clear to the user
10. Commands should be `easy to remember` and `intuitive` to use
8. Product is expected to be used in a system with at least 4GB RAM and `1GB free disk space`.
9. Product Visuals should be `unambiguous` and clear to the user
10. Commands should be `easy to remember` and `intuitive` to use
11. Product should be `consistent` in its visuals and commands formatting

*{More to be added}*
Expand Down
18 changes: 10 additions & 8 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ JobApplicationsBook Pro (JABPro) is a **desktop app for hiring managers of compa
Some example commands you can try:

* `add n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01`: adds an applicant with the specified contact details

* `remark 1 r/Great attitude, hardworking`: edits the remark of the 1st person on the list to have a remark `Great attitude, hardworking`

* `search n/John`: Searches for applicants whose names contain the keyword `John`

* `delete 3` : Deletes the 3rd contact shown in the current list.

* `set` : sets the applicant status to either of: (Preliminary, Interviewed, Rejected, Offered)

* `add linkedin 1 alexyeoh`: Adds LinkedIn account to candidate's existing contact information

* `github Alex Yeoh`: Redirects the user to the Github account of the candidate


Expand Down Expand Up @@ -120,7 +120,7 @@ Format: `view INDEX`
* Compatible with search and other features that change the order and content of the list.

Examples:
* `view 1`
* `view 1`
Shows the complete details of the 1st person on the list.


Expand Down Expand Up @@ -148,12 +148,14 @@ Examples:

Shows a list of all persons in the address book.

Format: `list s/ATTRIBUTE`
Format: `list so/ATTRIBUTE`

* `s/ATTRIBUTE` is completely **optional**, on default will NOT be sorted.
* `so/ATTRIBUTE` is completely **optional**, on default will NOT be sorted.
* As of v1.2, the attributes that are supported are `name` and `email`.
* Attribute is case-insensitive: `list s/NAME` and `list s/name` return the same result.
* Attribute is case-insensitive: `list so/NAME` and `list so/name` return the same result.
* The result will be sorted in **ascending** order.
* Note: as of v1.2, the sorting algorithm is case-sensitive, which means it will treat uppercase and
lowercase letters as distinct. This may result in names being sorted as A B C a b c, rather than A a B b C c.

Examples:
* `list` Shows a list of all persons.
Expand Down
4 changes: 2 additions & 2 deletions docs/team/ariellacallista.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: "Ariella Callista's Project Portfolio Page"
---

# Project: JABPRO
## Overview
## Overview
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.
It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc. It serves as a one-stop addressbook for job applications.
## Summary of Contributions
**Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=ariellacallista&breakdown=true)
**Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=ariellacallista&breakdown=true)

**Enhancement implemented**:

Expand Down
2 changes: 1 addition & 1 deletion docs/team/madlamprey.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "Misra Aditya's Project Portfolio Page"
---

# Project: JABPRO
## Overview
## Overview
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.
It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc. It serves as a one-stop addressbook for job applications.
## Summary of Contributions
Expand Down
4 changes: 2 additions & 2 deletions docs/team/scarletblanks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: "Peng Tat's Project Portfolio Page"
---

# Project: JABPRO
## Overview
## Overview
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.
It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc. It serves as a one-stop addressbook for job applications.
## Summary of Contributions
**Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=&sort=groupTitle%20dsc&sortWithin=title&since=2023-09-22&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=ScarletBlanks&tabRepo=AY2324S1-CS2103T-W09-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false)
**Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=&sort=groupTitle%20dsc&sortWithin=title&since=2023-09-22&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=ScarletBlanks&tabRepo=AY2324S1-CS2103T-W09-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false)
**Enhancement implemented**:
**Contribution to the UG**:
**Contribution to DG**:* Contributed to DG for non-functional requirements
Expand Down
8 changes: 4 additions & 4 deletions docs/team/sk2001git.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ layout: default.md
title: "Sean Koh's Project Portfolio Page"
---

# Project: JABPRO
# Project: JABPRO

## Overview
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.
## Overview
JABPro aims to solve the problem of HR managers having to sort through tons of job applications.

It makes their life easier by allowing them to easily fetch important info about job applicants such as their contact details, application status etc. It serves as a one-stop addressbook for job applications.

## Summary of Contributions
**Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=sk2001git&sort=groupTitle%20dsc&sortWithin=title&since=2023-09-22&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=sk2001git&tabRepo=AY2324S1-CS2103T-W09-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false)

**Enhancement implemented**:
**Enhancement implemented**:
* Remark command

**Contribution to the UG**:
Expand Down
31 changes: 14 additions & 17 deletions src/main/java/seedu/address/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_SORT;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.util.Comparator;
Expand All @@ -18,21 +19,13 @@ public class ListCommand extends Command {
public static final String MESSAGE_SUCCESS = "Listed all persons";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Lists all persons. "
+ "Parameters: [s/ATTRIBUTE]\n"
+ "Parameters: [so/ATTRIBUTE]\n"
+ "Optional: ATTRIBUTE can be 'name' or other attributes for sorting.\n"
+ "Example: " + COMMAND_WORD + " s/name";
+ "Example: " + COMMAND_WORD + " " + PREFIX_SORT + "name";

public static final Comparator<Person> DEFAULT_COMPARATOR = (person1, person2) -> 0; // Comparator that does nothing
private final Comparator<Person> sortingComparator;


/**
* Creates a ListCommand with no sorting.
*/
public ListCommand() {
// Default constructor for no sorting
this.sortingComparator = null;
}

/**
* Creates a ListCommand with the specified sorting comparator.
*
Expand All @@ -42,16 +35,20 @@ public ListCommand(Comparator<Person> sortingComparator) {
this.sortingComparator = sortingComparator;
}

/**
* Gets the sorting comparator currently set for sorting the list of persons.
*
* @return The comparator used for sorting the list.
*/
public Comparator<Person> getSortingComparator() {
return sortingComparator;
}

@Override
public CommandResult execute(Model model) {
requireNonNull(model);

if (sortingComparator != null) {
model.sortPersonList(sortingComparator);
}

model.sortPersonList(sortingComparator);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);

return new CommandResult(MESSAGE_SUCCESS);
}
}
1 change: 0 additions & 1 deletion src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class CliSyntax {
public static final Prefix PREFIX_PHONE = new Prefix("p/");
public static final Prefix PREFIX_EMAIL = new Prefix("e/");
public static final Prefix PREFIX_ADDRESS = new Prefix("a/");

public static final Prefix PREFIX_REMARK = new Prefix("r/");

public static final Prefix PREFIX_VIEW = new Prefix("v/");
Expand Down
Loading

0 comments on commit 059aa8f

Please sign in to comment.