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

Update report output #287

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading