From 998ff0a11a95deb31f74db4d103125a9b035ef95 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 16 Sep 2024 00:51:18 +0200 Subject: [PATCH] Rename --- open_prices/products/models.py | 8 ++++---- open_prices/products/tests.py | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/open_prices/products/models.py b/open_prices/products/models.py index f4f055f..34bac2d 100644 --- a/open_prices/products/models.py +++ b/open_prices/products/models.py @@ -74,22 +74,22 @@ def update_price_count(self): self.price_count = self.prices.count() self.save(update_fields=["price_count"]) - def price_min(self, exclude_discounted=False): + def price__min(self, exclude_discounted=False): if exclude_discounted: return self.prices.exclude_discounted().calculate_min() return self.prices.calculate_min() - def price_max(self, exclude_discounted=False): + def price__max(self, exclude_discounted=False): if exclude_discounted: return self.prices.exclude_discounted().calculate_max() return self.prices.calculate_max() - def price_avg(self, exclude_discounted=False): + def price__avg(self, exclude_discounted=False): if exclude_discounted: return self.prices.exclude_discounted().calculate_avg() return self.prices.calculate_avg() - def price_stats(self, exclude_discounted=False): + def price__stats(self, exclude_discounted=False): if exclude_discounted: return self.prices.exclude_discounted().calculate_stats() return self.prices.calculate_stats() diff --git a/open_prices/products/tests.py b/open_prices/products/tests.py index 3b2a3e4..6a91504 100644 --- a/open_prices/products/tests.py +++ b/open_prices/products/tests.py @@ -111,20 +111,21 @@ def test_update_price_count(self): self.product.update_price_count() self.assertEqual(self.product.price_count, 0) - def test_price_min(self): - self.assertEqual(self.product.price_min(), 1.0) - self.assertEqual(self.product.price_min(exclude_discounted=True), 2.0) + def test_price__min(self): + self.assertEqual(self.product.price__min(), 1.0) + self.assertEqual(self.product.price__min(exclude_discounted=True), 2.0) - def test_price_max(self): - self.assertEqual(self.product.price_max(), 2.0) + def test_price__max(self): + self.assertEqual(self.product.price__max(), 2.0) + self.assertEqual(self.product.price__max(exclude_discounted=True), 2.0) - def test_price_avg(self): - self.assertEqual(self.product.price_avg(), 1.5) - self.assertEqual(self.product.price_avg(exclude_discounted=True), 2.0) + def test_price__avg(self): + self.assertEqual(self.product.price__avg(), 1.5) + self.assertEqual(self.product.price__avg(exclude_discounted=True), 2.0) - def test_price_stats(self): + def test_price__stats(self): self.assertEqual( - self.product.price_stats(), + self.product.price__stats(), { "price__count": 2, "price__min": Decimal("1.0"), @@ -133,7 +134,7 @@ def test_price_stats(self): }, ) self.assertEqual( - self.product.price_stats(exclude_discounted=True), + self.product.price__stats(exclude_discounted=True), { "price__count": 1, "price__min": Decimal("2.0"),