-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add Order-in-Advance feature #202
Conversation
docs/UserGuide.md
Outdated
e.g. for a command with format `add-i n/NAME q/QUANTITY`, <br> | ||
replace `NAME` and `QUANTITY` with your input: `add-i n/Chicken q/10`. | ||
|
||
* In the format of commands, square brackets are to indicate optional fields. The square brackets are not necessary.<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* In the format of commands, square brackets are to indicate optional fields. The square brackets are not necessary.<br> | |
* In the format of commands, square brackets are to indicate optional fields. The fields in the square brackets are not mandatory to input.<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually i meant to say that the square brackets themselves are not necessary bc that was what Aileen feedbacked to us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iirc that was because Aileen had a misunderstanding between the command format and the actual command. Saying square brackets are not necessary is wrong because if you put them in the actual command then it's wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok fixed in latest commit
/** {@code Comparator} that returns a ItemComparator */ | ||
Comparator<Delivery> DELIVERY_COMPARATOR = new DeliveryEndTimeComparator(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't feel like it should belong in the interface, but in the implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long min = Long.parseLong(minutes); | ||
LocalDateTime endTime = LocalDateTime.now().plusMinutes(min); | ||
|
||
return new Time(minutes, endTime.format(DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little weird how many times you need to format it. Perhaps have the constructor take in a LocalDateTime instead of a String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In one of my earlier commits I made that change, for the constructor to take in a LocalDateTime but that implementation had its own problems, such as every single class that needed to use Time had to import LocalDateTime as well as ensure proper formatting of its inputs before passing into the constructor (or else it would throw a DateTimeParseException).
Hence i reverted it to this implementation where Time takes in a String and all parsing is done within the class
public Time(String minutes, String endTime) { | ||
requireNonNull(minutes, endTime); | ||
|
||
LocalDateTime time = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should make the pattern string a constant since it's being used multiple times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with string constant in commit:
dfe617d
/* | ||
try { | ||
LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss")); | ||
} catch (DateTimeParseException e) { | ||
throw new IllegalValueException(Time.MESSAGE_CONSTRAINTS); | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this commented chunk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the other parts of the code, this section here is to check if the JSON info is valid (ie. is the data file corrupt). However, this does not work for this implementation of Time, as we are not storing user input, but we are storing the endTime. Hence we cannot pass the endTime field through the same isValidQuantity/isValidName/etc. method, as that regex is used to test user input not to test this.
I removed this because I am handling the parsing inside the Time class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to just delete it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok true, fixed in latest commit
endTime = delivery.getEndTime(); | ||
initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps a better name instead of initialise to make it clear what it's initialising. (Maybe initialiseDeliveryCountdown)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to initializeDeliveryCountdown() in commit:
e156dfc
/* No such thing as duplicate delivery | ||
@Test | ||
public void execute_duplicateDelivery_throwsCommandException() { | ||
Delivery delivery = model.getDeliveryBook().getDeliveryList().get(0); | ||
assertCommandFailure(new DeliveryAddCommand(delivery), model, DeliveryAddCommand.MESSAGE_DUPLICATE_DELIVERY); | ||
} | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost LGTM, can you just remove this test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in latest commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issues resolved:
#128
#129
#198