Skip to content

Fix code that doesn't work on Ginkgo (Django 1.8)#261

Merged
johnbaldwin merged 2 commits into
masterfrom
john/fix-ginkgo
Sep 28, 2020
Merged

Fix code that doesn't work on Ginkgo (Django 1.8)#261
johnbaldwin merged 2 commits into
masterfrom
john/fix-ginkgo

Conversation

@johnbaldwin

@johnbaldwin johnbaldwin commented Sep 26, 2020

Copy link
Copy Markdown
Contributor

https://appsembler.atlassian.net/browse/RED-1348

The issue is that Django 1.8 does not support relative comparison for
the 'day' field in QuerySets. Example, this does not work:

SomeModel.objects(my_date_field__day__lte=some_day

So we need to perform an explicit datetime range when running with
Django 1.8

Since doing the commit as specified for "non-ginkgo" is more readable,
we don't want to throw it away. Instead, when we no longer have to
support Django 1.8 (meaning Ginkgo), we can then remove this check in
MAU

Tests updated to improve date range checking for MAU

Also added missing django-celery to the ginkgo requirements file

@codecov-commenter

codecov-commenter commented Sep 26, 2020

Copy link
Copy Markdown

Codecov Report

Merging #261 into master will decrease coverage by 0.15%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #261      +/-   ##
==========================================
- Coverage   92.03%   91.87%   -0.16%     
==========================================
  Files          41       41              
  Lines        2134     2142       +8     
==========================================
+ Hits         1964     1968       +4     
- Misses        170      174       +4     
Impacted Files Coverage Δ
figures/mau.py 91.11% <60.00%> (-8.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20b51b9...eaa0655. Read the comment docs.

Comment thread figures/mau.py Outdated
modified__month=date_for.month,
modified__day__lte=date_for.day)

# For now, directly doing compat check here and not creating an abstracted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# For now, directly doing compat check here and not creating an abstracted
# TODO: Remove this `if` branch after dropping Ginkgo support.
# For now, directly doing compat check here and not creating an abstracted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Thanks

The issue is that Django 1.8 does not support relative comparison for
the 'day' field in QuerySets. Example, this does not work:

`SomeModel.objects(my_date_field__day__lte=some_day`

So we need to perform an explicit datetime range when running with
Django 1.8

Since doing the commit as specified for "non-ginkgo" is more readable,
we don't want to throw it away. Instead, when we no longer have to
support Django 1.8 (meaning Ginkgo), we can then remove this check in
MAU

Tests updated to improve date range checking for MAU
@johnbaldwin
johnbaldwin merged commit 122c879 into master Sep 28, 2020
@johnbaldwin
johnbaldwin deleted the john/fix-ginkgo branch September 28, 2020 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants