From 500b4c5931150c7917f5c84f9a9103c287c6e7e7 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 22 Sep 2025 13:09:33 -0400 Subject: [PATCH] fix url issues --- app/api/services/account.py | 14 ++++++++------ app/models/members_profile.py | 10 +++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/api/services/account.py b/app/api/services/account.py index 5a47e86..2d724f1 100644 --- a/app/api/services/account.py +++ b/app/api/services/account.py @@ -7,7 +7,7 @@ from marshmallow import ValidationError from app.api.enums import TransactionType # from app.api.integrations import SimbrellaIntegration from app.extensions import db -from app.models import Members, MembersActions, MembersProfile, Payments +from app.models import Members, MembersActions, MembersProfile, Payments, MembersProducts # from app.api.services.offer_analysis import OfferAnalysis from app.api.helpers.response_helper import ResponseHelper from werkzeug.security import generate_password_hash, check_password_hash @@ -223,7 +223,7 @@ class AccountService(BaseService): url_name = str(validated_data.get('url_name')) #verify is anybody is using this url name - urlNammeData = MembersProfile.get_member_product_by_url_name(url_name) + urlNammeData = MembersProfile.get_any_member_profile_by_url_name(url_name) if urlNammeData: return { "error": 'Duplicate url name', @@ -252,11 +252,13 @@ class AccountService(BaseService): profile_uid = current_profile.uid profile_completed = member.profile_completed else: - profle_result = MembersProfile.create_member_profile(member.id, practice, specialization, + profile_result = MembersProfile.create_member_profile(member.id, practice, specialization, introduction,url_name) - if profle_result: - profile_uid = profle_result.uid - if profile_uid is not None and profile_uid != '': + if profile_result: + profile_uid = profile_result.uid + + current_profile = MembersProfile.get_member_profile_by_member_id(member.id) + if profile_uid is not None and profile_uid != '' and current_profile is not None: profile_completed = Members.set_member_profile_completed(member_data['uid']) result_data = { diff --git a/app/models/members_profile.py b/app/models/members_profile.py index 7cbcd5d..6f01094 100644 --- a/app/models/members_profile.py +++ b/app/models/members_profile.py @@ -45,11 +45,11 @@ class MembersProfile(db.Model): return member_profile @classmethod - def get_member_product_by_url_name(cls, url_name): - member_product = cls.query.filter_by(url_name=str(url_name)).first() - if not member_product: + def get_any_member_profile_by_url_name(cls, url_name): + member_profile = cls.query.filter_by(url_name=str(url_name)).first() + if not member_profile: return None - return member_product + return member_profile @classmethod @@ -70,7 +70,7 @@ class MembersProfile(db.Model): (0 rows) ''' - logger.info(f" Data for Profile Data {member_id} ,{practice} ,{specialization}, {introduction} ") + logger.info(f" Data for Profile Data {member_id} ,{practice} ,{specialization}, {introduction} {url_name} ") profile_data = cls( uid=str(uuid.uuid4()), member_id=member_id,