forgot await
Browse files- App/Users/Model.py +3 -4
App/Users/Model.py
CHANGED
@@ -157,6 +157,7 @@ class User(models.Model):
|
|
157 |
raise e
|
158 |
new_user = await cls.create(**user_data)
|
159 |
logger.info(f"User {new_user.phoneNumber} created successfully.")
|
|
|
160 |
# if there is a promotion and activate the user
|
161 |
promo_plans = await Plan.filter(is_promo=True).all()
|
162 |
for promo_plan in promo_plans:
|
@@ -166,15 +167,13 @@ class User(models.Model):
|
|
166 |
plan=promo_plan, send_message=True
|
167 |
)
|
168 |
await new_user.activate_user()
|
|
|
169 |
|
170 |
# Create the user in the database
|
171 |
|
172 |
# Decide whether to rollback user creation or proceed
|
173 |
# For simplicity, we'll proceed
|
174 |
|
175 |
-
# Send welcome message
|
176 |
-
await new_user.send_welcome_message()
|
177 |
-
|
178 |
return new_user
|
179 |
except Exception as e:
|
180 |
logger.error(f"Error creating user: {e}")
|
@@ -202,7 +201,7 @@ class User(models.Model):
|
|
202 |
)
|
203 |
await self.activate_user()
|
204 |
if send_message:
|
205 |
-
self.send_plan_subscription_message(
|
206 |
plan=plan, expiration_time=expiration_time
|
207 |
)
|
208 |
|
|
|
157 |
raise e
|
158 |
new_user = await cls.create(**user_data)
|
159 |
logger.info(f"User {new_user.phoneNumber} created successfully.")
|
160 |
+
await new_user.send_welcome_message()
|
161 |
# if there is a promotion and activate the user
|
162 |
promo_plans = await Plan.filter(is_promo=True).all()
|
163 |
for promo_plan in promo_plans:
|
|
|
167 |
plan=promo_plan, send_message=True
|
168 |
)
|
169 |
await new_user.activate_user()
|
170 |
+
break
|
171 |
|
172 |
# Create the user in the database
|
173 |
|
174 |
# Decide whether to rollback user creation or proceed
|
175 |
# For simplicity, we'll proceed
|
176 |
|
|
|
|
|
|
|
177 |
return new_user
|
178 |
except Exception as e:
|
179 |
logger.error(f"Error creating user: {e}")
|
|
|
201 |
)
|
202 |
await self.activate_user()
|
203 |
if send_message:
|
204 |
+
await self.send_plan_subscription_message(
|
205 |
plan=plan, expiration_time=expiration_time
|
206 |
)
|
207 |
|