Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create PinCommand feature #99

Merged
merged 22 commits into from
Mar 27, 2024

Conversation

cheahTJ
Copy link

@cheahTJ cheahTJ commented Mar 26, 2024

Linked to #43, will work on the test cases in the upcoming commit

@cheahTJ cheahTJ added this to the v1.3 milestone Mar 26, 2024
@cheahTJ cheahTJ self-assigned this Mar 26, 2024
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 77.08333% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 76.29%. Comparing base (02d35e7) to head (48c5b03).

Files Patch % Lines
...va/seedu/address/logic/commands/DeleteCommand.java 63.15% 10 Missing and 4 partials ⚠️
...seedu/address/logic/parser/GroupCommandParser.java 25.00% 1 Missing and 2 partials ⚠️
...eedu/address/logic/parser/DeleteCommandParser.java 81.81% 1 Missing and 1 partial ⚠️
.../seedu/address/logic/parser/AddressBookParser.java 0.00% 1 Missing ⚠️
...a/seedu/address/logic/parser/PinCommandParser.java 87.50% 0 Missing and 1 partial ⚠️
...a/seedu/address/model/person/UniquePersonList.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             add-pin-command      #99      +/-   ##
=====================================================
- Coverage              76.44%   76.29%   -0.16%     
- Complexity               521      545      +24     
=====================================================
  Files                     82       84       +2     
  Lines                   1690     1772      +82     
  Branches                 169      187      +18     
=====================================================
+ Hits                    1292     1352      +60     
- Misses                   347      360      +13     
- Partials                  51       60       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@Ragnapop Ragnapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM!

public class PinCommand extends Command {
public static final String COMMAND_WORD = "pin";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Pin a student to the top of the address book. "
+ "Parameters: NusId (8 digits long, starting with an 'E'). \n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just realised nusid is 7 digits long, not 8

Comment on lines +37 to +39
List<Person> lastShownList = model.getFilteredPersonList();
Person personToPin = lastShownList.stream().filter(person -> person.getNusId().equals(nusId))
.findFirst().orElse(null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good use of streams

Comment on lines +35 to +37
private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could be useful for every future class, consider re-adapting this into ArgumentMultimap class as a public method?

cheahTJ and others added 3 commits March 27, 2024 16:29
…15-2/delete_feature

Able to delete in group for delete feature
* master:
  Update DeleteCommand.java
  resolve errors
  Update DeleteCommandParser.java
  documentationupdate
  Update DeleteCommandParser.java
  Update DeleteCommandParser.java
  Resolve review
  update testcases
  checkstyle
  Update DeleteCommand.java
  Update DeleteCommand.java
  update checkstyle
  Update DeleteCommandParser.java
  Update DeleteCommand.java
  modify-delete-command
@hjuntan
Copy link

hjuntan commented Mar 27, 2024

Require documentation of pin command: Can be added in another pr

@hjuntan hjuntan merged commit 497e594 into AY2324S2-CS2103T-T15-2:add-pin-command Mar 27, 2024
5 checks passed
@hjuntan hjuntan mentioned this pull request Mar 27, 2024
Comment on lines +75 to +77
for (int i = 0; i < lastShownList.size(); i++) {
if (lastShownList.get(i).getGroups().equals(deletedGroup) ) {
peopleToDelete.add(lastShownList.get(i));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible case of deep nesting, perhaps extracting a new method might look better>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants