mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-22 20:56:59 +00:00
remove Refilling.is_validated
This commit is contained in:
@@ -350,7 +350,6 @@ class Command(BaseCommand):
|
|||||||
date=make_aware(
|
date=make_aware(
|
||||||
self.faker.date_time_between(customer.since, localdate())
|
self.faker.date_time_between(customer.since, localdate())
|
||||||
),
|
),
|
||||||
is_validated=True,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
sales.extend(this_customer_sales)
|
sales.extend(this_customer_sales)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Migration(migrations.Migration):
|
|||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RemoveField(model_name="selling", name="is_validated"),
|
migrations.RemoveField(model_name="selling", name="is_validated"),
|
||||||
|
migrations.RemoveField(model_name="refilling", name="is_validated"),
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name="selling",
|
model_name="selling",
|
||||||
old_name="payment_method",
|
old_name="payment_method",
|
||||||
|
|||||||
@@ -755,7 +755,6 @@ class Refilling(models.Model):
|
|||||||
bank = models.CharField(
|
bank = models.CharField(
|
||||||
_("bank"), max_length=255, choices=settings.SITH_COUNTER_BANK, default="OTHER"
|
_("bank"), max_length=255, choices=settings.SITH_COUNTER_BANK, default="OTHER"
|
||||||
)
|
)
|
||||||
is_validated = models.BooleanField(_("is validated"), default=False)
|
|
||||||
|
|
||||||
objects = RefillingQuerySet.as_manager()
|
objects = RefillingQuerySet.as_manager()
|
||||||
|
|
||||||
@@ -772,10 +771,9 @@ class Refilling(models.Model):
|
|||||||
if not self.date:
|
if not self.date:
|
||||||
self.date = timezone.now()
|
self.date = timezone.now()
|
||||||
self.full_clean()
|
self.full_clean()
|
||||||
if not self.is_validated:
|
if self._state.adding:
|
||||||
self.customer.amount += self.amount
|
self.customer.amount += self.amount
|
||||||
self.customer.save()
|
self.customer.save()
|
||||||
self.is_validated = True
|
|
||||||
if self.customer.user.preferences.notify_on_refill:
|
if self.customer.user.preferences.notify_on_refill:
|
||||||
Notification(
|
Notification(
|
||||||
user=self.customer.user,
|
user=self.customer.user,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def set_age(user: User, age: int):
|
|||||||
|
|
||||||
|
|
||||||
def force_refill_user(user: User, amount: Decimal | int):
|
def force_refill_user(user: User, amount: Decimal | int):
|
||||||
baker.make(Refilling, amount=amount, customer=user.customer, is_validated=False)
|
baker.make(Refilling, amount=amount, customer=user.customer)
|
||||||
|
|
||||||
|
|
||||||
class TestFullClickBase(TestCase):
|
class TestFullClickBase(TestCase):
|
||||||
|
|||||||
@@ -67,10 +67,7 @@ class InvoiceCallView(
|
|||||||
end_date = start_date + relativedelta(months=1)
|
end_date = start_date + relativedelta(months=1)
|
||||||
|
|
||||||
kwargs["sum_cb"] = Refilling.objects.filter(
|
kwargs["sum_cb"] = Refilling.objects.filter(
|
||||||
payment_method="CARD",
|
payment_method="CARD", date__gte=start_date, date__lte=end_date
|
||||||
is_validated=True,
|
|
||||||
date__gte=start_date,
|
|
||||||
date__lte=end_date,
|
|
||||||
).aggregate(res=Sum("amount", default=0))["res"]
|
).aggregate(res=Sum("amount", default=0))["res"]
|
||||||
kwargs["sum_cb"] += (
|
kwargs["sum_cb"] += (
|
||||||
Selling.objects.filter(
|
Selling.objects.filter(
|
||||||
|
|||||||
@@ -108,15 +108,22 @@ def test_eboutic_basket_expiry(
|
|||||||
|
|
||||||
client.force_login(customer.user)
|
client.force_login(customer.user)
|
||||||
|
|
||||||
sale_recipe.make(
|
if sellings:
|
||||||
customer=customer,
|
sale_recipe.make(
|
||||||
counter=eboutic,
|
customer=customer,
|
||||||
date=iter(sellings),
|
counter=eboutic,
|
||||||
_quantity=len(sellings),
|
date=iter(sellings),
|
||||||
_bulk_create=True,
|
_quantity=len(sellings),
|
||||||
)
|
_bulk_create=True,
|
||||||
for date in refillings:
|
)
|
||||||
refill_recipe.make(customer=customer, counter=eboutic, date=date)
|
if refillings:
|
||||||
|
refill_recipe.make(
|
||||||
|
customer=customer,
|
||||||
|
counter=eboutic,
|
||||||
|
date=iter(refillings),
|
||||||
|
_quantity=len(refillings),
|
||||||
|
_bulk_create=True,
|
||||||
|
)
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
f'x-data="basket({int(expected.timestamp() * 1000) if expected else "null"})"'
|
f'x-data="basket({int(expected.timestamp() * 1000) if expected else "null"})"'
|
||||||
|
|||||||
Reference in New Issue
Block a user