Skip to content

Commit

Permalink
Merge branch 'master' into branch-b-UserGuide
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyLCK committed Apr 13, 2024
2 parents 9105d66 + d21bee6 commit 9047d93
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
17 changes: 13 additions & 4 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* [3.1.5. Searching for a Person by Name](#315-searching-for-a-person-by-name--find)
* [3.1.6. Lookup Associated Articles](#316-lookup-associated-articles--lookup)
* [3.1.7. Sorting Persons by Name](#317-sorting-persons-by-name--sort-n)
* [3.1.8. Clearing All Persons](#318-clearing-all-persons--clear)
* [3.1.8. Filtering Persons](#318-filtering-people--filter)
* [3.1.9. Clearing All Persons](#319-clearing-all-persons--clear)
* [3.2. Managing Articles](#32-managing-articles)
* [3.2.1. Listing All Articles](#321-listing-all-articles--list--a)
* [3.2.2. Adding an Article](#322-adding-an-article--add--a)
Expand Down Expand Up @@ -265,7 +266,13 @@ After sorting:
Success message shown:
`sorted all persons by name`

### [3.1.8. Clearing All Persons : `clear`](#31-managing-contacts)
### [3.1.8 Filtering People: `filter`](#31-filtering-persons)

This is a planned command that will empower you to search for your contacts more swiftly.
Unfortunately, we have not yet implemented it, so using this command will return a command not found error.
We apologize for this inconvenience, and hope you look forward to this exciting new feature as much as we do!

### [3.1.9. Clearing All Persons : `clear`](#31-managing-contacts)

Clears all entries from the address book.

Expand Down Expand Up @@ -377,9 +384,11 @@ Format: `filter -a s/STATUS t/TAG ST/START_DATE EN/END_DATE`
* Filters will apply until you [remove](#327-removing-a-filter--rmfilter--a) it or apply a new filter, so make sure you [remove](#327-removing-a-filter--rmfilter--a) it after you are done!
* Refer to the [add article](#322-adding-an-article--add--a) command for the format of each field.
* Note that `START_DATE` and `END_DATE` must be in the same format as `DATE` in the [add article](#322-adding-an-article--add--a) command.

* The `START_DATE` should come **before** the `END_DATE`. If not, you will receive an error!
* The date of the article you are looking for should not be equal to the `START_DATE` or `END_DATE`.
* Only one filter command can be active at once, using another filter will override the last one.
Examples:
* `filter -a s/draft t/ st/ en/` will restrict the display to showing only articles with draft status.
* `filter -a s/DRAFT t/ st/ en/` will restrict the display to showing only articles with draft status.

### [3.2.7. Removing a Filter : `rmfilter -a`](#32-managing-articles)
Remove all filters so that all articles in PressPlanner's database are displayed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import seedu.address.model.article.ArticleMatchesTagPredicate;
import seedu.address.model.article.ArticleMatchesTimePeriodPredicate;
import seedu.address.model.article.PublicationDate;
import seedu.address.model.article.exceptions.InvalidDatesException;
import seedu.address.model.article.exceptions.InvalidStatusException;
import seedu.address.model.tag.Tag;

Expand All @@ -27,7 +28,7 @@ public class FilterArticleCommand extends ArticleCommand {
public static final String COMMAND_PREFIX = "-a";

public static final String MESSAGE_SUCCESS = "Filter online\nUse " + RemoveArticleFilterCommand.COMMAND_WORD
+ "-a to display all articles again";
+ " -a to display all articles again";
private Predicate<Article> finalPredicate;

/**
Expand Down Expand Up @@ -55,6 +56,8 @@ public FilterArticleCommand(String status, String tagName, String start, String
}
Predicate<Article> timePredicate = new ArticleMatchesTimePeriodPredicate(startDate, endDate);
finalPredicate = finalPredicate.and(timePredicate);
} catch (InvalidDatesException x) {
throw new ParseException(x.getMessage());
} catch (ParseException e) {
throw e;
}
Expand Down

0 comments on commit 9047d93

Please sign in to comment.