Revert "posts: fix rounding errors in ratio: metatag."

This reverts commit 80ced3e418.

This turned out to be intentional. Rounding the aspect ratio to 2
decimal places is so that searches for exact ratios like `ratio:16:9` or
`ratio:1.78` work even when the ratio doesn't exactly match. Rounding to
2 decimal places means that the ratio: metatag has a 1% error tolerance.
This commit is contained in:
evazion
2022-05-22 12:33:37 -05:00
parent c6b5be1c9f
commit d346adabc9

View File

@@ -98,7 +98,7 @@ class PostQueryBuilder
when "mpixels"
relation.attribute_matches(value, "posts.image_width * posts.image_height / 1000000.0", :float)
when "ratio"
relation.attribute_matches(value, "posts.image_width::numeric / posts.image_height::numeric", :ratio)
relation.attribute_matches(value, "ROUND(1.0 * posts.image_width / GREATEST(1, posts.image_height), 2)", :ratio)
when "score"
relation.attribute_matches(value, :score)
when "upvotes"