Skip to content

Commit

Permalink
Merge pull request nus-cs2113-AY2324S2#36 from samuelory/Samuel-V0.3
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
samuelory committed Mar 20, 2024
2 parents eae7883 + a69a52f commit 39be5d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/main/java/florizz/core/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ public static Command parse (String input) throws FlorizzException{
}
}

private static AddBouquetCommand handleAddBouquet(String input){
String newBouquetName = input.substring(input.indexOf(" ") + 1);
private static AddBouquetCommand handleAddBouquet(String input) throws FlorizzException{
if (!input.contains(" ")){
throw new FlorizzException("Did not include bouquet to add");
}
String newBouquetName = input.substring(input.indexOf(" ") + 1).trim();
return new AddBouquetCommand(new Bouquet(newBouquetName));
}

private static DeleteBouquetCommand handleDeleteBouquet(String input){
String bouquetToDelete = input.substring(input.indexOf(" ") + 1);
private static DeleteBouquetCommand handleDeleteBouquet(String input) throws FlorizzException{
if (!input.contains(" ")){
throw new FlorizzException("Did not include bouquet to delete");
}
String bouquetToDelete = input.substring(input.indexOf(" ") + 1).trim();
return new DeleteBouquetCommand(new Bouquet(bouquetToDelete));
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/florizz/objects/Bouquet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package florizz.objects;

import java.util.Locale;
import java.util.Objects;

public class Bouquet {
Expand Down Expand Up @@ -28,6 +29,6 @@ public boolean equals(Object obj) {
Bouquet c = (Bouquet) obj;

// Compare the data members and return accordingly
return Objects.equals(c.bouquetName, this.bouquetName);
return Objects.equals(c.bouquetName.toUpperCase(), this.bouquetName.toUpperCase());
}
}

0 comments on commit 39be5d5

Please sign in to comment.