-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Add find_free_time
command
#63
Conversation
This predicate checks that for a given time range, a student is free.
Adds a new command similar to `FindCommand` except it finds students who are free in the specified timing.
Wrong logic this just returned false for when a student is free at the specified timing.
A `FindFreeTimeCommandParser` to parse and crap out the `FindFreeTimeCommand` with the relevant `startTime` and `endTime` parsed
Whitespace separation was missing when stating how the `find_free_time` command is to be used.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #63 +/- ##
============================================
- Coverage 59.64% 57.86% -1.79%
Complexity 434 434
============================================
Files 91 94 +3
Lines 1819 1875 +56
Branches 178 186 +8
============================================
Hits 1085 1085
- Misses 696 752 +56
Partials 38 38 ☔ View full report in Codecov by Sentry. |
Adds a 'd/' prefix to the `FindFreeTimeCommand` so that users can specify a day.
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.
Very cool PR, just one small nit on the compareTo part
return student.getModuleTimings() | ||
.stream() | ||
.filter( | ||
moduleTiming -> moduleTiming.getDay().equals(day) | ||
) | ||
.noneMatch( | ||
moduleTiming -> | ||
startTime.compareTo(moduleTiming.getEndTime()) == -1 | ||
&& endTime.compareTo(moduleTiming.getStartTime()) == 1 | ||
); |
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.
/** | ||
* Tests that a {@code Student} is free between a given timing | ||
*/ | ||
public class IsFreePredicate implements Predicate<Student> { |
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.
Very cool usage of Predicate
This PR adds a
find_free_time
command that finds all students who do not have any module timings that clash with the specified timing.Solves #45
Example command
find_free_time d/Wed st/1845 et/1900