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

Handle calculateFrequency edge case #5507

Merged
merged 1 commit into from
Mar 14, 2018
Merged

Handle calculateFrequency edge case #5507

merged 1 commit into from
Mar 14, 2018

Conversation

noisysocks
Copy link
Member

@noisysocks noisysocks commented Mar 8, 2018

This updates calculateFrequency to explicitly handle an edge case spotted by @aduth in #5342 (comment).

The edge case is that time will be undefined for all blocks when a user first upgrades Gutenberg to the version that contains this new functionality.

In this case, we'll simply assume that the block was used somewhere between a day and one week ago.

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended [Feature] Inserter The main way to insert blocks using the + button in the editing interface labels Mar 8, 2018
@noisysocks noisysocks requested a review from aduth March 8, 2018 18:38
@aduth aduth added this to the 2.4 milestone Mar 14, 2018
Explicitly handle the case where `time` is undefined due to the user
upgrading their version of Gutenberg.
@aduth aduth force-pushed the fix/calculate-frecency branch from a43d609 to c01283c Compare March 14, 2018 13:43
Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Added a couple test cases 👍

@aduth aduth merged commit aaef836 into master Mar 14, 2018
@aduth aduth deleted the fix/calculate-frecency branch March 14, 2018 14:06
@noisysocks
Copy link
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants