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

Added savepdf Command. #208

Merged
merged 11 commits into from Nov 2, 2019
Merged

Added savepdf Command. #208

merged 11 commits into from Nov 2, 2019

Conversation

junnbang
Copy link

@junnbang junnbang commented Nov 2, 2019

Closes #123

Format:
-savepdf
-savepdf [DATE]

Saves drivers' tasks into pdf format.

image

@junnbang junnbang added this to the v1.4 milestone Nov 2, 2019
@junnbang junnbang requested a review from a team November 2, 2019 08:56
@junnbang junnbang self-assigned this Nov 2, 2019
Copy link

@tysg tysg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a pretty cool feature. Just some adjustments


private static final String FILE_PATH_FOR_PDF = "./data/" + FILE_NAME + " %1$s.pdf";

private final Clock clock;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GlobalClock

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved

*
* @throws ParseException if date format is invalid.
*/
public static LocalDate parseAnyDate(String date) throws ParseException {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should replace parseDate. Parser shouldn't be checking if the day is before today actually, it's a parser so any date that is valid should pass.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, check today on wards at command side

}

try {
Optional<LocalDate> date = Optional.of(ParserUtil.parseAnyDate(args));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason with using Optional? Date should always be non null.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

savepdf has optional date input, so if there's no date input, then ill throw in a optional.empty() as parameter of the constructor

* @param date date of delivery.
* @return filtered task list that contains only tasks on a specific date and are ONGOING or COMPLETE.
*/
private List<Task> filterTasksBasedOnDate(List<Task> tasks, LocalDate date) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seems very familiar. If it's anywhere else, consider reusing that code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i try and find

@junnbang junnbang merged commit 130b60b into master Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save as pdf command to display tasks of each driver for that day.
2 participants