Skip to content

Commit

Permalink
Merge pull request #236 from yashpola/branch-status-patches
Browse files Browse the repository at this point in the history
Remedy code-related bug-fixes for status
  • Loading branch information
headcube1 authored Apr 8, 2024
2 parents d36006e + 0e03d39 commit f4fcf1b
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 439 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public FilterPersonsByStatusCommand(Status targetStatus) {
public CommandResult execute(Model model) {
requireNonNull(model);

boolean existsMatchingPersons = model.getFilteredPersonList().stream()
boolean existsMatchingPersons = model.getAddressBook().getPersonList().stream()
.anyMatch(person -> person.getCurrentStatus().equals(targetStatus.toString()));
if (!existsMatchingPersons) {
return new CommandResult("No persons found with status: " + targetStatus.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package seedu.address.logic.parser;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;

import seedu.address.commons.exceptions.IllegalValueException;
Expand All @@ -27,8 +26,7 @@ public AddApplicantStatusCommand parse(String args) throws ParseException {
try {
phone = ParserUtil.parsePhone(argMultimap.getPreamble());
} catch (IllegalValueException ive) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
AddApplicantStatusCommand.MESSAGE_USAGE), ive);
throw new ParseException(Phone.MESSAGE_CONSTRAINTS, ive);
}

ApplicantStatus applicantStatus = ParserUtil.parseApplicantStatus(argMultimap
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import seedu.address.logic.commands.AddApplicantStatusCommand;
import seedu.address.logic.commands.AddInterviewCommand;
import seedu.address.logic.commands.AddInterviewerPersonCommand;
import seedu.address.logic.commands.AddInterviewerStatusCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
Expand Down Expand Up @@ -92,9 +91,6 @@ public Command parseCommand(String userInput) throws ParseException {
case AddApplicantStatusCommand.COMMAND_WORD:
return new AddApplicantStatusCommandParser().parse(arguments);

case AddInterviewerStatusCommand.COMMAND_WORD:
return new AddInterviewerStatusCommandParser().parse(arguments);

case ListCommand.COMMAND_WORD:
return new ListCommand();

Expand Down
16 changes: 0 additions & 16 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.ApplicantStatus;
import seedu.address.model.person.Email;
import seedu.address.model.person.InterviewerStatus;
import seedu.address.model.person.Name;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;
Expand Down Expand Up @@ -122,19 +121,4 @@ public static ApplicantStatus parseApplicantStatus(String applicantStatus) throw
}
return new ApplicantStatus(trimmedApplicantStatus);
}

/**
* Parses a {@code String status} into a {@code InterviewerStatus}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code status} is invalid.
*/
public static InterviewerStatus parseInterviewerStatus(String interviewerStatus) throws ParseException {
requireNonNull(interviewerStatus);
String trimmedInterviewerStatus = interviewerStatus.trim().toLowerCase();
if (!InterviewerStatus.isValidStatus(trimmedInterviewerStatus)) {
throw new ParseException(InterviewerStatus.MESSAGE_CONSTRAINTS);
}
return new InterviewerStatus(trimmedInterviewerStatus);
}
}
6 changes: 1 addition & 5 deletions src/main/java/seedu/address/model/person/Applicant.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
public class Applicant extends Person {

private final Type type = Type.APPLICANT;
private ApplicantStatus previousStatus;
private ApplicantStatus currentStatus;

/**
Expand Down Expand Up @@ -43,7 +42,6 @@ public String getPersonType() {
*/
@Override
public void updateCurrentStatusToReflectScheduledInterview(Model model) {
previousStatus = currentStatus;
currentStatus = new ApplicantStatus(ApplicantState.STAGE_TWO.toString());
/*
Need to find this applicant by reference equality and replace them for the change in status to reflect in
Expand All @@ -59,9 +57,7 @@ public void updateCurrentStatusToReflectScheduledInterview(Model model) {
*/
@Override
public void revertCurrentStatus(Model model) {
currentStatus = previousStatus == null
? new ApplicantStatus(ApplicantState.STAGE_ONE.toString())
: previousStatus;
currentStatus = new ApplicantStatus(ApplicantState.STAGE_ONE.toString());
/*
Need to find this applicant by reference equality and replace them for the change in status to reflect in
the gui immediately
Expand Down
Loading

0 comments on commit f4fcf1b

Please sign in to comment.