Conversion_Kitchen_Code/kitchen_counter/centralizePayment/utils.py

114 lines
6.7 KiB
Python
Executable File

# from .models import *
# import pandas as pd
# from MNF.settings import BasePath
# from django.http import HttpResponse
# basePath = BasePath()
# def create_juggernaut_models(user_object, service_name):
# df = pd.read_excel(f'{basePath}/juggernaut_package.xlsx')
# production_package = ['Radiate','Regionalise','Globalise']
# screen_package = ['Longjump','Triplejump','Highjump']
# if JuggernautPackage.objects.filter(user_id = user_object).exists():
# if JuggernautPackage.objects.filter(user_id = user_object).count() ==2 :
# dual_package=JuggernautPackage.objects.filter(user_id = user_object)
# for i in dual_package:
# if (i.package_name in production_package and service_name in production_package) or (i.package_name in screen_package and service_name in screen_package):
# jp = i
# break
# else:
# jp = JuggernautPackage.objects.get(user_id = user_object) #if user will take more than 2 package #change
# if (jp.package_name in production_package and service_name in production_package) or (jp.package_name in screen_package and service_name in screen_package):
# print("in if condition")
# for i,row in df.iterrows():
# if row['juggernaut_package'] == service_name:
# if jp.validity_days <= row['Validity_Days']:
# jp.validity_days = row['Validity_Days']
# jp.package_name += service_name
# jp.price += row['Price']
# jp.beat_scene_generation += row['beat_scene_generation']
# jp.beat_scene_generation_initial += row['beat_scene_generation']
# jp.conversion_pages +=row['conversion_pages']
# jp.conversion_pages_initial +=row['conversion_pages']
# jp.subtitling_minutes +=row['subtitling_minutes']
# jp.subtitling_minutes_initial +=row['subtitling_minutes']
# jp.scheduling_and_budget_projects +=row['scheduling_and_budget_projects']
# jp.scheduling_and_budget_projects_initial +=row['scheduling_and_budget_projects']
# jp.pitchdeck_one_pager +=row['pitchdeck_one_pager']
# jp.pitchdeck_elevator +=row['pitchdeck_elevator']
# jp.pitchdeck_screenplay +=row['pitchdeck_screenplay']
# jp.narrarion_character_intro +=row['narrarion_character_intro']
# jp.narrarion_line_by_line +=row['narrarion_line_by_line']
# jp.narrarion_characterwise +=row['narrarion_characterwise']
# jp.conversion_iteration +=row['conversion_iterations']
# jp.conversion_languages +=row['conversion_Languages']
# jp.subtitling_iteration +=row['subtitling_iterations']
# jp.subtitling_languages += row['subtitling_languages']
# print("merged data")
# break
# else:
# print("creating new one package of juggernaut")
# jp = JuggernautPackage()
# jp.user_id = user_object
# jp.package_name = service_name
# print(user_object,"user_object")
# for i,row in df.iterrows():
# if row['juggernaut_package'] == service_name:
# jp.validity_days =row['Validity_Days']
# jp.price = row['Price']
# jp.beat_scene_generation = row['beat_scene_generation']
# jp.beat_scene_generation_initial = row['beat_scene_generation']
# jp.conversion_pages =row['conversion_pages']
# jp.conversion_pages_initial =row['conversion_pages']
# jp.subtitling_minutes =row['subtitling_minutes']
# jp.subtitling_minutes_initial =row['subtitling_minutes']
# jp.scheduling_and_budget_projects =row['scheduling_and_budget_projects']
# jp.scheduling_and_budget_projects_initial =row['scheduling_and_budget_projects']
# jp.pitchdeck_one_pager =row['pitchdeck_one_pager']
# jp.pitchdeck_elevator =row['pitchdeck_elevator']
# jp.pitchdeck_screenplay =row['pitchdeck_screenplay']
# jp.narrarion_character_intro =row['narrarion_character_intro']
# jp.narrarion_line_by_line =row['narrarion_line_by_line']
# jp.narrarion_characterwise =row['narrarion_characterwise']
# jp.conversion_iteration =row['conversion_iterations']
# jp.conversion_languages =row['conversion_Languages']
# jp.subtitling_iteration =row['subtitling_iterations']
# jp.subtitling_languages = row['subtitling_languages']
# break
# else:
# print("creating new one package of juggernaut")
# jp = JuggernautPackage()
# jp.user_id = user_object
# jp.package_name = service_name
# print(user_object,"user_object")
# for i,row in df.iterrows():
# if row['juggernaut_package'] == service_name:
# jp.validity_days =row['Validity_Days']
# jp.price = row['Price']
# jp.beat_scene_generation = row['beat_scene_generation']
# jp.beat_scene_generation_initial = row['beat_scene_generation']
# jp.conversion_pages =row['conversion_pages']
# jp.conversion_pages_initial =row['conversion_pages']
# jp.subtitling_minutes =row['subtitling_minutes']
# jp.subtitling_minutes_initial =row['subtitling_minutes']
# jp.scheduling_and_budget_projects =row['scheduling_and_budget_projects']
# jp.scheduling_and_budget_projects_initial =row['scheduling_and_budget_projects']
# jp.pitchdeck_one_pager =row['pitchdeck_one_pager']
# jp.pitchdeck_elevator =row['pitchdeck_elevator']
# jp.pitchdeck_screenplay =row['pitchdeck_screenplay']
# jp.narrarion_character_intro =row['narrarion_character_intro']
# jp.narrarion_line_by_line =row['narrarion_line_by_line']
# jp.narrarion_characterwise =row['narrarion_characterwise']
# jp.conversion_iteration =row['conversion_iterations']
# jp.conversion_languages =row['conversion_Languages']
# jp.subtitling_iteration =row['subtitling_iterations']
# jp.subtitling_languages = row['subtitling_languages']
# break
# jp.save()
# return HttpResponse("Done transposed")