From 67ee372b982ed59cc0ec533f7bb435bda5feeaa3 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 5 Jun 2024 06:30:23 +0000 Subject: [PATCH] Juggernaut Updated --- kitchen_counter/juggernaut/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kitchen_counter/juggernaut/views.py b/kitchen_counter/juggernaut/views.py index 8071290..d16b70a 100644 --- a/kitchen_counter/juggernaut/views.py +++ b/kitchen_counter/juggernaut/views.py @@ -378,10 +378,7 @@ def update_narration(user_data,service_data, **kwargs): return("updated_narration",user_data) def update_conversion(user_data, service_data, **kwargs): - user_data.conversion_pages -= kwargs['conversion_pages'] - if user_data.conversion_pages < 0: - user_data.conversion_pages = 0 - user_data.save() + if JuggernautConversion.objects.filter(associated_project=kwargs['associated_project']).exists(): conversion_juggernaut = JuggernautConversion.objects.get(associated_project=kwargs['associated_project']) juggernaut_language_sets = JuggernautConversionSet.objects.filter(associated_project=kwargs['associated_project']) @@ -394,6 +391,10 @@ def update_conversion(user_data, service_data, **kwargs): conversion_juggernaut.languages += 1 conversion_juggernaut.save() else: + user_data.conversion_pages -= kwargs['conversion_pages'] + if user_data.conversion_pages < 0: + user_data.conversion_pages = 0 + user_data.save() jcs = JuggernautConversionSet() jcs.associated_project = kwargs['associated_project'] jcs.actionline_lang = kwargs['translation_language'][0]