Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

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

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 March 6, 2019 22:19
@@ -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)))
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch ;)

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

Choose a reason for hiding this comment

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

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 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

Choose a reason for hiding this comment

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

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date format is inconsistent
2 participants