This commit is contained in:
2021-11-11 11:37:04 +01:00
parent d566487d3a
commit 79736d8d72

View File

@@ -15,7 +15,7 @@ dictionary = {}
def add_dict(id, key, value):
dict = dictionary.get(id)
if key in dict:
print("increasing dict key for: ",value,"key IS: ",key)
print("increasing notsms dict key for: ",value,"key IS: ",key)
dict[key] += value
print("end state: ",dict[key])
@@ -26,10 +26,10 @@ def add_dict(id, key, value):
else:
print("Never should happen", id)
def add_dict2(id, pricesms):
def add_dictsms(id, pricesms):
dict = dictionary.get(id)
print("increasing dict key for: ",pricesms)
print("increasing sms dict key for dict: ",dict," for :",pricesms)
dict["smscount"] += pricesms
@@ -73,7 +73,7 @@ with open(FILE, newline='', encoding='utf-8') as csvfile:
price = float(row['CHARGE_NET'].replace(',','.'))
price = round(price, 5)
print("before conditions price: ",price)
typ = None
if row['CHARGE_TYPE'] == "Pravidelné měsíční poplatky":
@@ -98,15 +98,17 @@ with open(FILE, newline='', encoding='utf-8') as csvfile:
#only if not exist create new record in dictionary for ID
if not MSISDN in dictionary:
dictionary[MSISDN] = {'ICCID':ICCID,'data':0.00000, 'sms':0.00000, 'other':0.00000, 'smscount':pricesms}
print("Creating new dictionary: ", dictionary[MSISDN])
else:
print("Adding: ",price," for: ", dictionary[MSISDN], "TYP: ",typ)
print("Adding: ", price, " for: ", dictionary[MSISDN], "TYP: ",typ)
add_dict(MSISDN, typ, price)
if row['INCREMENT'] == "SMS":
print("pricesms: ",pricesms," for unit: ",dictionary[MSISDN])
add_dict2(MSISDN, pricesms)
add_dict(MSISDN, typ, price)
add_dictsms(MSISDN, pricesms)