Skip to content

Commit

Permalink
final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 23, 2024
1 parent e33720c commit 3ffe172
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion open_prices/proofs/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def test_select_proof_image_dir_existing_dir_create_new_dir(self):
self.assertEqual(selected_dir, images_dir / "0002")


class TestPriceTagCreation(TestCase):
class PriceTagCreationTest(TestCase):
def test_create_price_tag_invalid_bounding_box_length(self):
with self.assertRaises(ValidationError) as cm:
PriceTagFactory(
Expand Down
13 changes: 5 additions & 8 deletions open_prices/stats/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from django.utils import timezone
from solo.models import SingletonModel

from open_prices.proofs import constants as proof_constants


class TotalStats(SingletonModel):
PRICE_COUNT_FIELDS = [
Expand Down Expand Up @@ -37,6 +35,7 @@ class TotalStats(SingletonModel):
+ PRODUCT_COUNT_FIELDS
+ LOCATION_COUNT_FIELDS
+ PROOF_COUNT_FIELDS
+ PRICE_TAG_COUNT_FIELDS
+ USER_COUNT_FIELDS
)

Expand Down Expand Up @@ -115,12 +114,10 @@ def update_price_tag_stats(self):
from open_prices.proofs.models import PriceTag

self.price_tag_count = PriceTag.objects.count()
self.price_tag_status_unknown_count = PriceTag.objects.filter(
status=None
).count()
self.price_tag_status_linked_to_price_count = PriceTag.objects.filter(
status=proof_constants.PriceTagStatus.linked_to_price.value
).count()
self.price_tag_status_unknown_count = PriceTag.objects.status_unknown().count()
self.price_tag_status_linked_to_price_count = (
PriceTag.objects.status_linked_to_price().count()
)
self.save(update_fields=self.PRICE_TAG_COUNT_FIELDS + ["updated"])

def update_user_stats(self):
Expand Down

0 comments on commit 3ffe172

Please sign in to comment.