From af1cb704d5245be03604d8976e226ce2c7b45ac9 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 17 Dec 2020 16:52:42 +0100 Subject: [PATCH] fixing aspect_ratio --- ereuse_devicehub/resources/device/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 2bd14b6b..87f673ce 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -372,15 +372,14 @@ class DisplayMixin: """ if self.resolution_height and self.resolution_width: return Fraction(self.resolution_width, self.resolution_height) + return 0 # noinspection PyUnresolvedReferences @aspect_ratio.expression def aspect_ratio(cls): # The aspect ratio to use as SQL in the DB # This allows comparing resolutions - if cls.resolution_height and cls.resolution_width: - return db.func.round(cls.resolution_width / cls.resolution_height, 2) - return 4/3 + return db.func.round(cls.resolution_width / cls.resolution_height, 2) @hybrid_property def widescreen(self):