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

Incorrect conditional in lookback period logic #2572

Closed
wlthomson opened this issue Mar 24, 2020 · 2 comments · Fixed by #2607
Closed

Incorrect conditional in lookback period logic #2572

wlthomson opened this issue Mar 24, 2020 · 2 comments · Fixed by #2607
Assignees
Labels
Docs: not needed Effort: small Small effort story/task, estimated 0-2 days Priority: high
Milestone

Comments

@wlthomson
Copy link
Contributor

Describe the bug

Currently the lookback period logic has a typo/logic error causing the lookback period to be incorrectly applied to certain items. See #2564 (comment).

To reproduce

Bug can be seen in the following code:

const addedRecently = itemAddedDate.isBefore(lookbackDate);
const startDate = amcEnforceLookback || !addedRecently ? lookbackDate : itemAddedDate;

Expected behaviour

If not enforcing the lookback, the lookback is used if the item was added prior to the lookback date (currently using lookback if the item was added more recently than the lookback date).

Proposed Solution

Small logic change:

const useLookbackDate = amcEnforceLookback || itemAddedDate.isBefore(lookbackDate);
const startDate = useLookbackDate ? lookbackDate : itemAddedDate;

Version and device info

  • App version: v4.0.2
  • Tablet model: Android emulator.
  • OS version: API 28.

Additional context

N/A.

@wlthomson wlthomson self-assigned this Mar 24, 2020
@wlthomson wlthomson added Docs: not needed Effort: small Small effort story/task, estimated 0-2 days Priority: high labels Mar 24, 2020
@wlthomson wlthomson added this to the 4.0.X milestone Mar 24, 2020
wlthomson added a commit that referenced this issue Mar 28, 2020
…sage-conditional

#2572 fix incorrect daily usage conditional
@wlthomson
Copy link
Contributor Author

Fixed by #2607.

@wlthomson
Copy link
Contributor Author

Confirmed fixed on v5.0.0-rc3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs: not needed Effort: small Small effort story/task, estimated 0-2 days Priority: high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant