Skip to content

Commit

Permalink
Merge pull request #287 from awesomesjh/update-rename
Browse files Browse the repository at this point in the history
Update report output
  • Loading branch information
rismm committed Apr 15, 2024
2 parents 8f02ea8 + c903a8f commit 703bf3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ Test case: `report r/low stock t/100`

Expected: Prints Ham as it is the only item with quantity less than 100. Pie is not printed out as it has a quantity of exactly 100.
```
There is 1 items low on stocks!
There is 1 item low on stocks!
1. Name: Ham
Quantity: 0
```
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/supertracker/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private static String nothingSoldOpening(Item item) {
private static String reportLowStockOpening(int quantity) {
assert quantity >= 0;
String isOrAre = quantity == 1 ? "is " : "are ";
return "There " + isOrAre + quantity + " items low on stocks!";
String plural = quantity == 1 ? EMPTY_STRING : "s";
return "There " + isOrAre + quantity + " item" + plural + " low on stocks!";
}

/**
Expand Down Expand Up @@ -594,7 +595,7 @@ public static void clearCommandSuccess(int transactionsCleared, LocalDate before
printIndent("Nothing cleared. No transactions before " + dateString + " available to clear");
return;
}
String plural = transactionsCleared == 1 ? "" : "s";
String plural = transactionsCleared == 1 ? EMPTY_STRING : "s";
printIndent(transactionsCleared + " transaction" + plural
+ " before " + dateString + " successfully cleared!");
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/supertracker/command/ReportCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void reportCommand_lowStock_correctlyConstructed() throws TrackerExceptio
Command c = Parser.parseCommand(userInput);
c.execute();

String expected = " There is 1 items low on stocks!" + LINE_SEPARATOR +
String expected = " There is 1 item low on stocks!" + LINE_SEPARATOR +
" 1. Name: orange" + LINE_SEPARATOR +
" Quantity: 10" + LINE_SEPARATOR;
String actual = outContent.toString();
Expand Down

0 comments on commit 703bf3e

Please sign in to comment.