fix(promotion): fix promotion not valid condition
fix promotion not valid condition
This commit is contained in:
parent
50e69d985c
commit
8300f09003
2 changed files with 10 additions and 3 deletions
|
|
@ -502,7 +502,7 @@ class Promotion(BaseModel):
|
|||
if self.state not in [PaymentStateChoices.CREATED]:
|
||||
raise Exception(_('Cannot promote. not in correct state'))
|
||||
|
||||
if not self.promotion_amount or self.plan.balance_holder:
|
||||
if not self.promotion_amount:
|
||||
to_not_payed = self.change_state(
|
||||
from_states=[PaymentStateChoices.CREATED],
|
||||
to_state=PaymentStateChoices.SUCCESS,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
import logging
|
||||
|
||||
from apps.promotions.models import Event
|
||||
from main import celery_app
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@celery_app.task
|
||||
def analyze_event_task(event_uuid):
|
||||
event = Event.objects.get(uuid=event_uuid)
|
||||
for plan_analyze_result in event.analyze():
|
||||
try:
|
||||
for promotion in plan_analyze_result:
|
||||
print(promotion)
|
||||
except Exception:
|
||||
logger.exception('Failed to process plan for event %s', event_uuid)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue