-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove Date arg from class To Field of Meeting; Update Calendar to Schedule #211
Remove Date arg from class To Field of Meeting; Update Calendar to Schedule #211
Conversation
Class Time takes in args and parses as hh:mm.
To only takes in args HH:mm. Minor changes to error message.
Minor changes to styling and scaling.
Codecov Report
@@ Coverage Diff @@
## master #211 +/- ##
============================================
+ Coverage 53.72% 53.91% +0.19%
- Complexity 751 758 +7
============================================
Files 166 167 +1
Lines 3131 3144 +13
Branches 347 344 -3
============================================
+ Hits 1682 1695 +13
Misses 1341 1341
Partials 108 108
Continue to review full report at Codecov.
|
Include labels for schedule
LocalDateTime dateFrom = from.getLocalDateTime(); | ||
LocalDateTime dateTo = to.getLocalDateTime(); | ||
LocalTime dateFrom = from.getLocalDateTime().toLocalTime(); | ||
LocalTime dateTo = to.getLocalTime(); | ||
|
||
return dateFrom.compareTo(dateTo) <= 0; |
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.
I think its better to make it strictly less than.
public static final String TIME_REGEX = "(([0-1]\\d)|(2[0-3])):([0-5]\\d)"; | ||
public static final String MESSAGE_CONSTRAINTS = | ||
"Time should be in the format of HH:mm, " | ||
+ "minute must start with a leading zero."; |
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 its clearer to state that single digit hour and minute must start with a leading zero
@@ -20,7 +19,7 @@ | |||
+ "Note: Single digit month, day, and minute must start with a leading zero."; |
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.
Could you include hour here as well
"Time should be in the format of HH:mm, " | ||
+ "minute must start with a leading zero."; | ||
|
||
public static final String VALIDATION_REGEX = String.format("%s", TIME_REGEX); |
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.
Is this the same as TIME_REGEX?
editedMeeting = new MeetingBuilder(MEETING_A) | ||
.withTo(VALID_TO_B).build(); |
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.
I think VALID_TO_B should still work since its updated to 12:00
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.
nope it will throw false, MEETING_A has a time of 14:00.
@@ -68,10 +63,10 @@ public void isValidFromAndTo() { | |||
assertTrue(Meeting.isValidFromAndTo(new From(VALID_FROM_A), new To(VALID_TO_A))); | |||
|
|||
// FROM = TO -> returns true | |||
assertTrue(Meeting.isValidFromAndTo(new From(VALID_FROM_A), new To(VALID_FROM_A))); | |||
assertTrue(Meeting.isValidFromAndTo(new From(VALID_FROM_B), new To(VALID_TO_B))); |
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.
If we change the part in front this will now return false.
} | ||
|
||
@Test | ||
void parseFail() { |
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.
Might need to change the comments here
@@ -11,7 +11,6 @@ | |||
import java.util.Date; | |||
|
|||
public class DateTime implements Comparable<DateTime> { | |||
public static final String TIME_REGEX = "(([0-1]\\d)|(2[0-3])):([0-5]\\d)"; | |||
public static final String DATE_REGEX = "(([0-2]\\d)|(3[0-1]))-((0[1-9])|(1[0-2]))-(\\d{4})"; | |||
public static final String EARLIEST_DATE_STRING = "01-01-2019 00:00"; | |||
public static final String 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.
Perhaps we should shift this message to the deadline and from class and state explicitly that deadline/from should be in the format ...
|
||
public class Time implements Comparable<Time> { | ||
public static final String TIME_REGEX = "(([0-1]\\d)|(2[0-3])):([0-5]\\d)"; | ||
public static final String 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.
Same as above I think its better to shift this message into to class and say To should be in the format ...
@@ -49,8 +50,8 @@ public Meeting(Title title, OptionalDescription description, From from, To to, | |||
* Returns true if From is earlier than To chronologically. | |||
*/ | |||
public static boolean isValidFromAndTo (From from, To to) { |
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.
The error message for this prob needs to change also cos "to" is no longer a date.
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
Fixes #163
Fixes #137