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

Loan GUI display on add/delete loan + prevent editing stockCode #378

Merged
merged 22 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b7a6428
Add files via upload
cyanoei Oct 31, 2019
49a2bd3
Delete parser_seq.png
cyanoei Oct 31, 2019
624721e
Merge pull request #2 from cyanoei/remove_png
cyanoei Oct 31, 2019
71a9884
Merge branch 'master' of https://github.com/cyanoei/duke-team
cyanoei Oct 31, 2019
47e9a97
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Oct 31, 2019
5c9c9da
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Oct 31, 2019
000b5c5
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 1, 2019
b2f8325
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 1, 2019
c337794
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 1, 2019
6856c32
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 5, 2019
3d7d407
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 6, 2019
3dca13e
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 6, 2019
a1175e8
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 7, 2019
5253348
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 7, 2019
7d9f38e
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 7, 2019
4c46411
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 8, 2019
be62b16
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 8, 2019
aede86e
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 8, 2019
8682b7d
Merge branch 'master' of https://github.com/AY1920S1-CS2113T-F09-3/main
cyanoei Nov 9, 2019
9220200
Loan GUI fix #377
cyanoei Nov 9, 2019
8a57021
Prevent stockCode edit (which might create bugs for loan)
cyanoei Nov 9, 2019
5457f15
Merge commit 'acf7ed9ccd6c5bccce648bc7257698a6d37e99a1' into loan_gui…
cyanoei Nov 9, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public String execute(StockList list, Ui ui, Storage storage) {
output += QuantityManager.checkMinimum(stock);
}

ui.drawTable(LoanList.getAllLoansStruct());
ui.print(output);

return output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public String execute(StockList list, Ui ui, Storage storage) throws BadInputExc
+ "Person: %s | Stock: %s | Quantity: %d", matricNo, stockCode, quantity));
}

ui.drawTable(LoanList.getAllLoansStruct());
ui.print(output);
return output;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/eggventory/logic/parsers/ParseEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ private Command processEditStock(String input) throws BadInputException {
String stockCode = editInput[0];
switch (editInput[1]) {
case "stockcode":
throw new BadInputException("Sorry, stockCode cannot be edited in v1.4.");
/*
checkStockCode(editInput[2]);
return new EditStockCommand(CommandType.EDIT, stockCode, StockProperty.STOCKCODE,
editInput[2].toLowerCase());

*/
case "quantity":
return new EditStockCommand(CommandType.EDIT, stockCode, StockProperty.QUANTITY,
editInput[2].toLowerCase());
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/eggventory/logic/parsers/ParseEditTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public void setParseEditStockType_ReservedArgument_ThrowsBadInputException() {

@Test
public void setParseEditStock_InvalidProperty_ThrowsBadInputException() {
//stockcode
assertDoesNotThrow(() -> testParser.parse("stock #stockcode stockcode arg3"));
//stockcode cannot be edited.
//assertDoesNotThrow(() -> testParser.parse("stock #stockcode stockcode arg3"));
assertThrows(BadInputException.class, () -> testParser.parse("stock #stockcode wrongProperty arg3"));

//quantity
Expand Down Expand Up @@ -48,7 +48,7 @@ public void setParseEditStock_InvalidProperty_ThrowsBadInputException() {
public void testParseEdit_BadFirstInput_ThrowsBadInputException() {
//only stock and stocktype can be first input
//edit stock <stockcode> <property> <newValue>
assertDoesNotThrow(() -> testParser.parse("stock #test stockcode arg3"));
assertDoesNotThrow(() -> testParser.parse("stock #test description arg3"));
//edit stocktype <stocktypename> <newName>
assertDoesNotThrow(() -> testParser.parse("stocktype arg1 arg2"));
assertThrows(BadInputException.class, () -> testParser.parse("sommething arg1 arg2"));
Expand Down