2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 05:57:18 +00:00

wallets subfolders fiddling

This commit is contained in:
2024-08-11 15:19:59 +03:00
parent e64cb212c1
commit 74ce8894d2
2 changed files with 32 additions and 13 deletions

View File

@@ -85,15 +85,15 @@ def load_all_scans():
seen = []
c = 0
wallets = {}
for p in scans_path.rglob("*"):
for p in scans_path.rglob("*"): # this implicitly ignoires empty folders as it looks only for files
if p.is_file():
if p.suffix.lower() not in valids and p.name.lower() not in validnames:
# if p.suffix.lower() not in valids and p.name.lower() not in validnames:
# # we do not care how the files are called. Many have no suffices at all.
# print(f"'{p}'", end='\n')
pass
elif p.parent == scans_path: # skip files directly in /surveyscans/
# pass
if p.parent == scans_path: # skip files directly in /surveyscans/
pass
else:
c += 1
if c % 15 == 0:
print(".", end="")
@@ -101,6 +101,7 @@ def load_all_scans():
print("\n ", end="")
if p.parent.parent.parent.parent == scans_path:
# the wallet has subfolders, which we are uninterested in at this point.
# print(f"too deep {p}", end='\n')
fpath = p.parent.parent
walletname = p.parent.parent.name # wallet is one level higher
@@ -167,7 +168,7 @@ def load_all_scans():
)
print(f"\n - found another {wjson:,} JSON files, making a total of {len(wallets):,} wallets")
# Only the 1999 wallets have filenames which mean that the walletyear will be unset:
# Only the 1999 wallets have filepaths which would mean that the walletyear will be unset:
wallets = Wallet.objects.filter(walletyear=None)
for w in wallets:
w.walletyear = datetime.date(1999, 1, 1)