diff options
Diffstat (limited to 'parsers/scans.py')
-rw-r--r-- | parsers/scans.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/parsers/scans.py b/parsers/scans.py index 10c659f..b18dd64 100644 --- a/parsers/scans.py +++ b/parsers/scans.py @@ -110,11 +110,25 @@ def load_all_scans(): CheckEmptyPeople(wallet) wallet.save() LoadListScansFile(wallet) - - + + else: # but We should load all the scans, even for nonstandard names. print(f'\n - IGNORE {walletname} - {fpath}') - + + # but we also need to check if JSON exists, even if there are no uploaded scan files + contents_path = Path(settings.DRAWINGS_DATA, "walletjson") + for yeardir in contents_path.iterdir(): + if yeardir.is_dir(): + for walletpath in yeardir.iterdir(): + if Path(walletpath, contentsjson).is_file(): + walletname = walletpath.name + wallet, created = Wallet.objects.update_or_create(walletname=walletname) + if created: + print(f"\n{walletname} created: only JSON, no actual uploaded scan files.", end=' ') + CheckEmptyDate(wallet) + CheckEmptyPeople(wallet) + wallet.save() + print("", flush=True) |