fix creating dud progress entries

When the import process finishes it can set progress to 100 multiple
times.  The first call would add a stop time to the running progress,
but each further call with progress=100 would create another entry in
the table with stop already set.
This commit is contained in:
ducklet 2021-07-27 23:47:34 +02:00
parent 57cfd8f496
commit e939e57a8f

View file

@ -136,6 +136,12 @@ async def set_import_progress(progress: float) -> Progress:
progress = min(max(0.0, progress), 100.0) # clamp to 0 <= progress <= 100
current = await get_import_progress()
is_stopped = current and current.stopped is not None
if progress == 100.0 and is_stopped:
assert current
return current
is_update = current and current.stopped is None
if not current or not is_update: