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

Make sure date string format is consistent #57

Merged
merged 15 commits into from Mar 8, 2019

Conversation

@mrengler
Copy link
Contributor

@mrengler mrengler commented Mar 6, 2019

Types of changes

  • Bug fix ( addresses issue #56 )

Description

Added function in date_utils.py to convert any parse-able date string into the desired format dd-mm-YYYY. Added call to that function as part of sanitize_fatality_entity() in apd.py.

These changes ensure that the dates returned will all be formatted the same, improving readability.

Checklist:

  • I have updated the documentation accordingly
  • I have written unit tests

#56

Fixes #56

@rgreinho rgreinho self-requested a review Mar 6, 2019
@@ -166,7 +166,7 @@ def parse_twitter_description(twitter_description):
# Parse the Deceased field.
if d.get(Fields.DECEASED):
try:
d.update(parse_deaceased_field(d.get(Fields.DECEASED)))
d.update(parse_deceased_field(d.get(Fields.DECEASED)))

This comment has been minimized.

@rgreinho

rgreinho Mar 7, 2019
Member

Nice catch ;)

:rtype: str
"""
dt = parse_date(date)
return datetime.datetime.strftime(dt, "%d/%m/%Y")

This comment has been minimized.

@rgreinho

rgreinho Mar 7, 2019
Member

I apologize I made a mistake, the English format for the date is MM/DD/YYYY, so if you can just reverse these two first fields that would be great.

That would also make your test pass.

@rgreinho
Copy link
Member

@rgreinho rgreinho commented Mar 7, 2019

Good job on your first PR @mrengler! It looks very good.

I apologize again for the mistake I made in the issue regarding the date format. Luckily it is an easy one to fix.

Aside of that, just a few minor remarks:

  • As you normalized the date format, you will also have to update all the other tests which involve a date field.
  • You will need to update the commit message of your first commit:
    • Just add a small paragraph describing the what you just did (and "why" if applicable).
    • The last last line of the message should be Fixes scrapd/scrapd#56. This is a line used by GitHub to automatically close the issue. Here are 2 good examples:
  • Edit the CHANGELOG with a one line desciption of what you did. If you are not familiar with the KeepAChangelog format, you can read more about it here. It should look like this:
## [Unreleased]

### Fixed

- Fix inconsistent date format. All the new date fields now follow the English format `MM/DD/YYYY`. [#57]

## [[1.4.2]] - 2019-03-03

And at the end of the CHANGELOG, add a link to the issue:

[#56]: https://github.com/scrapd/scrapd/issues/56

@rgreinho rgreinho added the bug label Mar 7, 2019
Copy link
Member

@rgreinho rgreinho left a comment

Great job! Thanks a lot for your contribution and all the efforts keep the code base clean 👍

@rgreinho rgreinho merged commit c34d3a0 into scrapd:master Mar 8, 2019
6 checks passed
6 checks passed
ci/circleci: docs Your tests passed on CircleCI!
Details
ci/circleci: format Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: prepare Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
coverage/coveralls First build on date_format_fix at 96.813%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants