From 44082bbde9fab399f524e88bdb12f483ce409529 Mon Sep 17 00:00:00 2001 From: jbukhari Date: Mon, 20 May 2024 12:15:13 -0400 Subject: [PATCH 1/3] limit bugfix --- dlx_dl/scripts/sync/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlx_dl/scripts/sync/__init__.py b/dlx_dl/scripts/sync/__init__.py index 726b0b2..8424414 100644 --- a/dlx_dl/scripts/sync/__init__.py +++ b/dlx_dl/scripts/sync/__init__.py @@ -252,7 +252,7 @@ def run(**kwargs): #print(f'{SEEN} / {TOTAL} ', end='', flush=True) # limits - if args.limit != 0 and updated_count == args.limit: + if args.limit != 0 and updated_count >= args.limit: print('\nReached max exports') enqueue = True if args.queue else False break From ce9b08bf834ba4fa5594e9ce40479bb16d8a0a56 Mon Sep 17 00:00:00 2001 From: jbukhari Date: Mon, 20 May 2024 12:17:16 -0400 Subject: [PATCH 2/3] don't proceed with export automatically after 3 hours --- dlx_dl/scripts/sync/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlx_dl/scripts/sync/__init__.py b/dlx_dl/scripts/sync/__init__.py index 8424414..54d15f7 100644 --- a/dlx_dl/scripts/sync/__init__.py +++ b/dlx_dl/scripts/sync/__init__.py @@ -120,8 +120,8 @@ def run(**kwargs): pass elif last is None: raise Exception('No log data found for this source') - elif (datetime.now() - (last.get('time') or datetime.min)) > timedelta(hours=3): # skip check if more than 3 hours - print("wait time limit exceeded for last import confirmation. proceeding") + #elif (datetime.now() - (last.get('time') or datetime.min)) > timedelta(hours=3): # skip check if more than 3 hours + # print("wait time limit exceeded for last import confirmation. proceeding") elif last: pre = '035__a:(DHL)' if args.type == 'bib' else '035__a:(DHLAUTH)' url = f'{API_SEARCH_URL}?search_id=&p={pre}{last["record_id"]}&format=xml' From 68484de1a8b02338e7afc3ba462c6a0f4f981d5a Mon Sep 17 00:00:00 2001 From: jbukhari Date: Tue, 21 May 2024 09:41:05 -0400 Subject: [PATCH 3/3] fix field deletion --- dlx_dl/scripts/sync/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlx_dl/scripts/sync/__init__.py b/dlx_dl/scripts/sync/__init__.py index 54d15f7..9e25c67 100644 --- a/dlx_dl/scripts/sync/__init__.py +++ b/dlx_dl/scripts/sync/__init__.py @@ -496,10 +496,13 @@ def compare_and_update(args, *, dlx_record, dl_record): continue if normalize(field.to_mrk()) not in [normalize(x) for x in dlx_fields_serialized]: - if field.tag in [x.tag for x in dlx_fields]: + # compare tag + indicators + if field.tag + ''.join(field.indicators) in [x.tag + ''.join(x.indicators) for x in dlx_fields]: + # this should already be taken care of in dlx->dl print(f'{dlx_record.id}: SUPERCEDED: {field.to_mrk()}') take_tags.add(field.tag) else: + # delete fields where the tag + indicators combo does not exist in dl record print(f'{dlx_record.id}: TO DELETE: {field.to_mrk()}') # use the field in the export to delete the field in DL by setting values to empty string