in jobs/eam-integrations/scripts/workday_netsuite_integration.py [0:0]
def compare_and_save_data(wd_workers, upd_list, terminated, wd_comp, ns_comp):
data = []
wd_workers_upd = [x for x in wd_workers if x.Employee_ID in upd_list]
wd_workers_upd = [x for x in wd_workers_upd if x.Employee_ID not in terminated]
for i, wd_worker in enumerate(wd_workers_upd):
print("---------------------------------------")
print(wd_comp[wd_worker.Employee_ID])
print(ns_comp[wd_worker.Employee_ID])
# Input strings
string1 = wd_comp[wd_worker.Employee_ID]
string2 = ns_comp[wd_worker.Employee_ID]
# Split the strings by '|'
list1 = string1.split('|')
list2 = string2.split('|')
# Compare the lists
differences1 = [""]*20
differences1[0] = wd_worker.Employee_ID
differences1[1] = "workday"
differences2 = [""]*20
differences2[0] = wd_worker.Employee_ID
differences2[1] = "netsuite"
for index, (item1, item2) in enumerate(zip(list1, list2)):
if item1 != item2:
#differences.append((index, item1, item2))
differences1[index+2] = item1
differences2[index+2] = item2
data.append(differences1)
data.append(differences2)
csv_file_path = 'employees_upd.csv' # Path to save the CSV file
data_to_csv(data, csv_file_path)