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 ratio calculation bug #1123

Merged
merged 13 commits into from
Mar 22, 2019
Merged

Fix ratio calculation bug #1123

merged 13 commits into from
Mar 22, 2019

Conversation

danielamorse
Copy link
Collaborator

@danielamorse danielamorse commented Mar 20, 2019

Jira

Summary

  • Fixed the ratio bug that sometimes miscalculated aspect ratio
  • Added tests for logo, where we first noticed the bug

Details

Previously, in ratio.twig we were dividing ratio height or width values by 100 when the value was > 100. This worked fine when both values were either > 100 or < 100 but failed when one was above and the other below. The error would miscalculate the aspect ratio, causing the visual regression we saw with the logo.

Instead of dividing by 100, I'm now getting the greatest common divisor of our ratio values (via a new twig function). I added VR tests for logo and updated the tests to use the new reduced fractions.

How to test

@danielamorse danielamorse changed the title Fix ratio bug Fix ratio calculation bug Mar 20, 2019
Copy link
Collaborator

@adamszalapski adamszalapski left a comment

Choose a reason for hiding this comment

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

Great work @danielamorse , from my perspective look perfect 👍

Copy link
Contributor

@sghoweri sghoweri left a comment

Choose a reason for hiding this comment

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

Nice job @danielamorse - this looks great!

As discussed, my only 2 cents on this is that I added two extra tests to make sure we're checking to make sure ratios that have fraction data contain decimals also works (just in case). Approved 👍

@sghoweri sghoweri mentioned this pull request Mar 22, 2019
@sghoweri sghoweri merged commit 7a5ab00 into master Mar 22, 2019
@sghoweri sghoweri deleted the fix/logo-ratio-bug branch March 22, 2019 18:29
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