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

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

Merged
merged 2 commits into from
Sep 28, 2020

Conversation

johnbaldwin
Copy link
Contributor

@johnbaldwin johnbaldwin commented Sep 26, 2020

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

codecov-commenter commented Sep 26, 2020

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.

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