fixed history allowing adding the same clan twice

This commit is contained in:
Qubasa
2023-12-14 18:54:00 +01:00
parent cf899cbee9
commit 962a5641b4

View File

@@ -58,16 +58,14 @@ def add_history(uri: ClanURI) -> list[HistoryEntry]:
found = True found = True
entry.last_used = datetime.datetime.now().isoformat() entry.last_used = datetime.datetime.now().isoformat()
if found: if not found:
break flake = inspect_flake(path, machine)
flake.flake_url = str(flake.flake_url)
flake = inspect_flake(path, machine) history = HistoryEntry(
flake.flake_url = str(flake.flake_url) flake=flake,
history = HistoryEntry( last_used=datetime.datetime.now().isoformat(),
flake=flake, )
last_used=datetime.datetime.now().isoformat(), logs.append(history)
)
logs.append(history)
with locked_open(user_history_file(), "w+") as f: with locked_open(user_history_file(), "w+") as f:
f.write(json.dumps(logs, cls=EnhancedJSONEncoder, indent=4)) f.write(json.dumps(logs, cls=EnhancedJSONEncoder, indent=4))