Skip to content

Commit

Permalink
Merge pull request #155 from ray-97/v1.2
Browse files Browse the repository at this point in the history
fix portion stuff again
  • Loading branch information
thrivinb authored Apr 2, 2020
2 parents 1271659 + 6fb088e commit 8c24644
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/life/calgo/logic/parser/NomCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
public class NomCommandParser implements Parser<NomCommand> {

public static final String MESSAGE_EMPTY_NAME = "You can't eat that because it does not exist in food record.";
public static final String MESSAGE_NEGATIVE_PORTION =
"You cannot eat negative portion of food, use vomit command instead.";
public static final String MESSAGE_NON_POSITIVE_PORTION =
"Portion should be a positive number.";

private final Model model;

Expand Down Expand Up @@ -65,8 +65,8 @@ public NomCommand parse(String args) throws ParseException {
if (argMultimap.getValue(PREFIX_PORTION).isPresent()) {
portion = ParserUtil.parsePortion(argMultimap.getValue(PREFIX_PORTION).get());
}
if (portion < 0) {
throw new ParseException(MESSAGE_NEGATIVE_PORTION);
if (portion <= 0) {
throw new ParseException(MESSAGE_NON_POSITIVE_PORTION);
}
Optional<Food> optionalFood = model.getFoodByName(
ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()));
Expand Down

0 comments on commit 8c24644

Please sign in to comment.