1
0
Fork 0
forked from fnux/rt2zammad

[rt2zammad] update range]

This commit is contained in:
kjg 2024-08-02 16:21:04 +09:00
parent 06b42d042b
commit e9d28bde1f

View file

@ -280,8 +280,17 @@ if not os.path.exists("rt2zammad.json"):
with open("rt2zammad.json") as handle: with open("rt2zammad.json") as handle:
config = json.load(handle) config = json.load(handle)
rt_start = config["rt_start"] #import_start = config["rt_start"]
rt_end = config["rt_end"] #import_end = config["rt_end"]
if len(sys.argv) != 3:
print(len(sys.argv))
print("It needs ticket range to import ex. start, end")
sys.exit()
else:
import_start = int(sys.argv[1])
import_end = int(sys.argv[2])
print(f"start : {import_start} end : {import_end}")
h2t = html2text.HTML2Text() h2t = html2text.HTML2Text()
zammad = get_zammad_session() zammad = get_zammad_session()
@ -296,7 +305,7 @@ ticket_ids = os.listdir("tickets/")
print(f"Found {len(ticket_ids)} tickets on filesystem.") print(f"Found {len(ticket_ids)} tickets on filesystem.")
ticket_ids = list(map(int, ticket_ids)) ticket_ids = list(map(int, ticket_ids))
ticket_ids.sort() ticket_ids.sort()
ticket_ids = list(map(int, ticket_ids[rt_start:rt_end])) ticket_ids = list(map(int, ticket_ids[import_start-1:import_end]))
for id in ticket_ids: for id in ticket_ids:
try: try: