forked from fnux/rt2zammad
[rt2zammad] update range
This commit is contained in:
parent
ce79a522b1
commit
13ab913c7b
1 changed files with 11 additions and 1 deletions
|
@ -60,7 +60,7 @@ def remove_duplicates_for(rt_id, zammad, retries=0):
|
||||||
try:
|
try:
|
||||||
matching_zammad_tickets= zammad.ticket.search(f"title: \"\[RT-{rt_id}\]*\"")
|
matching_zammad_tickets= zammad.ticket.search(f"title: \"\[RT-{rt_id}\]*\"")
|
||||||
#matching_zammad_tickets= zammad.ticket.search('number:16014')
|
#matching_zammad_tickets= zammad.ticket.search('number:16014')
|
||||||
print(matching_zammad_tickets[0])
|
#print(matching_zammad_tickets[0])
|
||||||
matching_zammad_ids = []
|
matching_zammad_ids = []
|
||||||
if len(matching_zammad_tickets) >= 2:
|
if len(matching_zammad_tickets) >= 2:
|
||||||
print(f"Found duplicates:")
|
print(f"Found duplicates:")
|
||||||
|
@ -96,6 +96,15 @@ 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)
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
@ -106,6 +115,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[import_start-1:import_end]))
|
||||||
|
|
||||||
for id in ticket_ids:
|
for id in ticket_ids:
|
||||||
print(f"Processing RT-{id}...")
|
print(f"Processing RT-{id}...")
|
||||||
|
|
Loading…
Reference in a new issue