Fixed Repeat 'already have ticket, do you want to wipe?' errors, by actually wiping it before starting over. Not just starting over directly, like before
This commit is contained in:
parent
07f0cf8007
commit
e18fec84f2
2 changed files with 25 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ def do_we_have_billing_id() -> str | None:
|
||||||
filepath = f"{billing_folder}/billing_choices.json"
|
filepath = f"{billing_folder}/billing_choices.json"
|
||||||
|
|
||||||
billing_id = get_value_from_json_file(filepath, "temp_billing_code")
|
billing_id = get_value_from_json_file(filepath, "temp_billing_code")
|
||||||
|
if billing_id == "":
|
||||||
|
return None
|
||||||
|
|
||||||
return billing_id
|
return billing_id
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,30 @@ from core.Constants import Constants
|
||||||
# generic
|
# generic
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
|
def delete_ticket_data():
|
||||||
|
ticket_folders = [Constants.HV_TICKETING_CONFIG_HOME, Constants.HV_TICKETING_DATA_HOME]
|
||||||
|
quantity_to_delete = len(ticket_folders)
|
||||||
|
deleted = 0
|
||||||
|
|
||||||
|
for each_folder in ticket_folders:
|
||||||
|
folder_path = Path(each_folder)
|
||||||
|
try:
|
||||||
|
shutil.rmtree(folder_path)
|
||||||
|
deleted = deleted + 1
|
||||||
|
logger.info(f"Deleted {folder_path}")
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.error(f"Couldn't delete this folder, because it was not found: {folder_path}")
|
||||||
|
pass
|
||||||
|
|
||||||
|
if deleted == quantity_to_delete:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def get_all_unused_tickets() -> dict:
|
def get_all_unused_tickets() -> dict:
|
||||||
data = read_entire_json(Constants.TICKET_TRACKER_PATH)
|
data = read_entire_json(Constants.TICKET_TRACKER_PATH)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue