-
Notifications
You must be signed in to change notification settings - Fork 2
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
Convert datetime values to strings before indexing (#3416) #3419
Convert datetime values to strings before indexing (#3416) #3419
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3419 +/- ##
===========================================
- Coverage 82.66% 82.65% -0.01%
===========================================
Files 123 123
Lines 14218 14212 -6
===========================================
- Hits 11753 11747 -6
Misses 2465 2465
Continue to review full report at Codecov.
|
c808295
to
521df86
Compare
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.
Looks good. Only made an optional suggestion.
src/azul/indexer/document.py
Outdated
if value is None: | ||
return self.null | ||
else: | ||
return format_dcp2_datetime(value) | ||
parse_dcp2_datetime(value) # to verify a valid dcp2 datetime string |
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 am not sure that this comment is necessary. Up to you.
521df86
to
ea3d269
Compare
src/azul/time.py
Outdated
if d is None: | ||
return None | ||
else: |
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.
A fixpoint like this is a smell. If None is a fixpoint in one function why is it not a fixpoint of every function?
Also, format and parse functions should be each other's inverse and this breaks that.
update_date = format_dcp2_datetime(entity.update_date) | ||
return { | ||
'submission_date': format_dcp2_datetime(entity.submission_date), | ||
'update_date': update_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.
'update_date': update_date, | |
'update_date': None | |
if entity.update_date is None else | |
format_dcp2_datetime(entity.update_date), |
src/azul/time.py
Outdated
>>> format_dcp2_datetime(None) | ||
Traceback (most recent call last): | ||
... | ||
AttributeError: 'NoneType' object has no attribute 'tzinfo' | ||
|
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.
>>> format_dcp2_datetime(None) | |
Traceback (most recent call last): | |
... | |
AttributeError: 'NoneType' object has no attribute 'tzinfo' |
e7a3355
to
73a24e4
Compare
73a24e4
to
3f17533
Compare
Failures during reindexing in dev:
These failure are expected because of: |
What's |
It's the bundle UUID. To produce this I ran:
|
#3416
Author
Fix:
for bugs) or there is a good reason why they're differentAuthor (reindex)
r
tag to commit title or this PR does not require reindexingreindex
label to PR or this PR does not require reindexingAuthor (freebies & chains)
chain
label to the blocking PR or this PR is not chained to another PRAuthor (upgrading)
u
tag to commit title or this PR does not require upgradingupgrade
label to PR or this PR does not require upgradingAuthor (requirements, before every review)
make requirements_update
or this PR leaves requirements*.txt, common.mk and Makefile untouchedR
tag to commit title or this PR leaves requirements*.txt untouchedreqs
label to PR or this PR leaves requirements*.txt untouchedAuthor (before every review)
make integration_test
passes in personal deployment or this PR does not touch functionality that could break the ITdevelop
, squashed old fixupsPrimary reviewer (after approval)
no demo
no sandbox
Operator (before pushing merge the commit)
reindex
label andr
commit title tagno demo
sandbox
label or PR is labeledno sandbox
no sandbox
sandbox
or this PR does not require reindexingsandbox
sandbox
or this PR does not require reindexingsandbox
Operator (after pushing the merge commit)
N reviews
labelling is accurateOperator (reindex)
dev
or this PR does not require reindexing or does not targetdev
dev
or this PR does not require reindexing or does not targetdev
prod
or this PR does not require reindexing or does not targetprod
prod
or this PR does not require reindexing or does not targetprod
Operator