From 6697d4c9a221d2155491e4b3b6a4473541ea21a2 Mon Sep 17 00:00:00 2001 From: Lin Shuang Shuang Date: Fri, 12 Apr 2024 10:43:34 +0800 Subject: [PATCH] Fix SetStatusCommandParser --- .../logic/parser/SetStatusCommandParser.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/SetStatusCommandParser.java b/src/main/java/seedu/address/logic/parser/SetStatusCommandParser.java index 0c94bc0657b..6dfb38831c8 100644 --- a/src/main/java/seedu/address/logic/parser/SetStatusCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/SetStatusCommandParser.java @@ -23,16 +23,6 @@ public class SetStatusCommandParser implements Parser { public SetStatusCommand parse(String args) throws ParseException { try { - if (args.contains(" /to ")) { - String status = args.split(" /to ")[0].trim(); - String projectString = args.split(" /to ")[1].trim(); - if ((projectString.length() == 0) || (status.length() == 0)) { - throw new ParseException("Please enter the status and project fields"); - } - Project project = new Project(ParserUtil.parseName(projectString)); - return new SetProjectStatusCommand(status, project); - } - if (!args.contains(" /of ")) { throw new ParseException(String.format( MESSAGE_INVALID_COMMAND_FORMAT, @@ -41,6 +31,16 @@ public SetStatusCommand parse(String args) throws ParseException { String status = args.split(" /of")[0].trim(); String taskAndProject = args.split(" /of")[1].trim(); + + if (!args.contains(" /in ")) { + if ((taskAndProject.length() == 0) || (status.length() == 0)) { + throw new ParseException("Please enter the status and project fields"); + } + Project project = new Project(ParserUtil.parseName(taskAndProject)); + return new SetProjectStatusCommand(status, project); + + } + if ((taskAndProject.length() == 0) || (status.length() == 0)) { throw new ParseException("Please enter the status, project and task fields"); }