From 6cb172c922cf57e22b89701859477015f5903221 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 23 May 2025 12:16:11 +0000 Subject: [PATCH] some pravesh conversion changes --- .../translation/external_conversion.py | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/kitchen_counter/conversion/translation/external_conversion.py b/kitchen_counter/conversion/translation/external_conversion.py index ce60079..f7c25d1 100755 --- a/kitchen_counter/conversion/translation/external_conversion.py +++ b/kitchen_counter/conversion/translation/external_conversion.py @@ -422,33 +422,37 @@ class Conversion: if obj.User_preference !="MNF": tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project), Data) + if tx_id == False: + obj.User_preference = "MNF" + obj.save() + else: - print("Tx id -> ", tx_id,tx_gas_fee) - print(type(tx_id)) + print("Tx id -> ", tx_id,tx_gas_fee) + print(type(tx_id)) + - - try: - user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=tx_gas_fee, - script_name=self.name_script) - addition_result = user_infos.update_info(self) - print("Blockchain Result -> ",addition_result) - except Exception as e: - print("Error:", e) + try: + user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=tx_gas_fee, + script_name=self.name_script) + addition_result = user_infos.update_info(self) + print("Blockchain Result -> ",addition_result) + except Exception as e: + print("Error:", e) - print("blockchain script conversion 6") - # certificatepath = certificateGenrate(self.user.username, "script conversion", hash) - certificatepath = certificateGenrate(self.user.username, "script conversion", hash, projectname=self.name_script, matic = tx_gas_fee) - hash = hash_decrypation(hash) - to_email = [self.user.email] - email_code = 'BL1' - - key_value = { - "Product Name": "script conversion", - "Profile url": f"{settings.SITE_DOMAIN}/memberpage/#/personaldetails", - "User url": f"{settings.SITE_DOMAIN}/memberpage/#/user/{self.user.id}/personaldetails", - "Product output card url": f"{settings.SITE_DOMAIN}/conversion/view_conversion/", - } - sendmail(to_email=to_email, email_code=email_code,key_value=key_value, filePath=certificatepath) + print("blockchain script conversion 6") + # certificatepath = certificateGenrate(self.user.username, "script conversion", hash) + certificatepath = certificateGenrate(self.user.username, "script conversion", hash, projectname=self.name_script, matic = tx_gas_fee) + hash = hash_decrypation(hash) + to_email = [self.user.email] + email_code = 'BL1' + + key_value = { + "Product Name": "script conversion", + "Profile url": f"{settings.SITE_DOMAIN}/memberpage/#/personaldetails", + "User url": f"{settings.SITE_DOMAIN}/memberpage/#/user/{self.user.id}/personaldetails", + "Product output card url": f"{settings.SITE_DOMAIN}/conversion/view_conversion/", + } + sendmail(to_email=to_email, email_code=email_code,key_value=key_value, filePath=certificatepath) except Exception as e: self.translated_script_object.error_desc = "Error in blockchain is " + str(e) self.translated_script_object.save()