2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-29 05:11:52 +00:00

bad bug in not clearing out previous data. fixed

This commit is contained in:
Philip Sargent 2022-08-16 16:48:19 +03:00
parent b2d8b21822
commit 51f5261bfc

View File

@ -252,7 +252,7 @@ def scanupload(request, path=None):
print(message) print(message)
return render(request,'errors/generic.html', {'message': message}) return render(request,'errors/generic.html', {'message': message})
else: else:
dr_commit = subprocess.run([git, "commit", "-m", f'Update of {contentsjson} in wallet'], cwd=destfolder, capture_output=True, text=True) dr_commit = subprocess.run([git, "commit", "-m", f'JSON update for wallet {wallet}'], cwd=destfolder, capture_output=True, text=True)
# This produces return code = 1 if it commits OK # This produces return code = 1 if it commits OK
if dr_commit.returncode != 0: if dr_commit.returncode != 0:
msgdata = 'Ask a nerd to fix this.\n\n' + dr_commit.stderr + '\n\n' + dr_commit.stdout + '\n\nreturn code: ' + str(dr_commit.returncode) msgdata = 'Ask a nerd to fix this.\n\n' + dr_commit.stderr + '\n\n' + dr_commit.stdout + '\n\nreturn code: ' + str(dr_commit.returncode)
@ -367,6 +367,8 @@ def scanupload(request, path=None):
multiple = request.FILES.getlist('uploadfiles') multiple = request.FILES.getlist('uploadfiles')
fs = FileSystemStorage(os.path.join(dirpath)) # creates wallet folder if necessary fs = FileSystemStorage(os.path.join(dirpath)) # creates wallet folder if necessary
wd = wallet_blank_json # clean this out
waldata = {} # clean this out
actual_saved = [] actual_saved = []
if multiple: if multiple:
for f in multiple: for f in multiple:
@ -386,7 +388,7 @@ def scanupload(request, path=None):
dirs = [] dirs = []
# print(f'! - FORM scanupload - start {wallet} {dirpath}') # print(f'! - FORM scanupload - start {wallet} {dirpath}')
if dirpath.is_dir(): if dirpath.is_dir():
create = False create = False # wallet exists becausse folder exists, even if nothing in it
try: try:
for f in dirpath.iterdir(): for f in dirpath.iterdir():
if f.is_dir(): if f.is_dir():
@ -406,6 +408,7 @@ def scanupload(request, path=None):
waldata = {} waldata = {}
if contents_path.is_file(): if contents_path.is_file():
create = False # yes wallet exists becaue JSON exists, even if no files in the surveyscans folder, or even if that folder does not exist
with open(contents_path) as json_file: with open(contents_path) as json_file:
try: try:
waldata = json.load(json_file) waldata = json.load(json_file)