From 31ef7d4e276199e0861d7a4c121eaa28f1725677 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 2 May 2024 07:48:38 +0000 Subject: [PATCH] latest conversion changes 02052024 --- .../management/commands/custom_runserver.py | 3 ++- .../conversion/translation/external_conversion.py | 13 +++++++++---- kitchen_counter/mnfapp/models.py | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/kitchen_counter/conversion/management/commands/custom_runserver.py b/kitchen_counter/conversion/management/commands/custom_runserver.py index 064764c..eaf4eb7 100755 --- a/kitchen_counter/conversion/management/commands/custom_runserver.py +++ b/kitchen_counter/conversion/management/commands/custom_runserver.py @@ -57,8 +57,9 @@ def run_conversion(msg): background_thread = threading.Thread(target=background_execution, args=(obj,)) background_thread.start() background_thread.join() + s3_client.delete_object(Bucket='conversion-kitchen', Key=object_key) msg.delete() - + def run_audit(msg): body_dict = json.loads(msg.body) diff --git a/kitchen_counter/conversion/translation/external_conversion.py b/kitchen_counter/conversion/translation/external_conversion.py index f2b594a..dfed378 100644 --- a/kitchen_counter/conversion/translation/external_conversion.py +++ b/kitchen_counter/conversion/translation/external_conversion.py @@ -510,14 +510,12 @@ class Conversion: try: response = s3_client.upload_file(filee, bucket, object_name) s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}" - self.translated_script_object.translated_script_pdf = s3_url + print(response) except Exception as e: print("Error is", e) - - else: """Blockchain Upload Starts here""" @@ -553,7 +551,10 @@ class Conversion: userkey = decryptionOfPrivate(userPrivateKey) tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project), Data) + print("Tx id -> ", tx_id,tx_gas_fee) + print(type(tx_id)) + # user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=2345432345123456) # addition_result = user_infos.update_info(request) try: @@ -582,10 +583,14 @@ class Conversion: """Blockchain Upload Ends here""" - + """Process Completed""" self.translated_script_object.status = "Completed" + try: + self.translated_script_object.blockchain_txhash = tx_id + except: + self.translated_script_object.translated_script_pdf = s3_url self.translated_script_object.save() return self.response diff --git a/kitchen_counter/mnfapp/models.py b/kitchen_counter/mnfapp/models.py index 1011087..ab303b3 100755 --- a/kitchen_counter/mnfapp/models.py +++ b/kitchen_counter/mnfapp/models.py @@ -290,6 +290,7 @@ class ScriptTranslations(models.Model): left_dual_dial_script = models.CharField(max_length=220, null=True, blank=True) free_output = models.BooleanField(default=False) status = models.CharField(max_length=220, null=True, blank=True) + blockchain_txhash = models.CharField(max_length=220, null=True, blank=True) error_desc = models.CharField(max_length=2000, null=True, blank=True)