mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-13 16:47:38 -03:00
refactor(download-history): rename mark_not_downloaded to mark_as_deleted
The method mark_not_downloaded() was misleading — it doesn't negate 'downloaded' history (the model was indeed downloaded before), but rather sets is_deleted_override = 1 to indicate the version was downloaded and subsequently deleted. This flag allows re-download when the 'skip previously downloaded' setting is enabled. Rename to mark_as_deleted() to accurately reflect its semantics.
This commit is contained in:
@@ -2065,7 +2065,7 @@ class ModelLibraryHandler:
|
|||||||
file_path=file_path if isinstance(file_path, str) else None,
|
file_path=file_path if isinstance(file_path, str) else None,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await history_service.mark_not_downloaded(model_type, model_version_id)
|
await history_service.mark_as_deleted(model_type, model_version_id)
|
||||||
|
|
||||||
return web.json_response(
|
return web.json_response(
|
||||||
{
|
{
|
||||||
@@ -2151,7 +2151,7 @@ class ModelLibraryHandler:
|
|||||||
await persist()
|
await persist()
|
||||||
|
|
||||||
history_service = await self._get_download_history_service()
|
history_service = await self._get_download_history_service()
|
||||||
await history_service.mark_not_downloaded(found_type, model_version_id)
|
await history_service.mark_as_deleted(found_type, model_version_id)
|
||||||
|
|
||||||
return web.json_response(
|
return web.json_response(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class DownloadedVersionHistoryService:
|
|||||||
)
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
async def mark_not_downloaded(self, model_type: str, version_id: int) -> None:
|
async def mark_as_deleted(self, model_type: str, version_id: int) -> None:
|
||||||
normalized_type = _normalize_model_type(model_type)
|
normalized_type = _normalize_model_type(model_type)
|
||||||
normalized_version_id = _normalize_int(version_id)
|
normalized_version_id = _normalize_int(version_id)
|
||||||
if normalized_type is None or normalized_version_id is None:
|
if normalized_type is None or normalized_version_id is None:
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class FakeDownloadHistoryService:
|
|||||||
async def mark_downloaded(self, *_args, **_kwargs):
|
async def mark_downloaded(self, *_args, **_kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def mark_not_downloaded(self, *_args, **_kwargs):
|
async def mark_as_deleted(self, *_args, **_kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -903,7 +903,7 @@ class FakeDownloadHistoryService:
|
|||||||
(model_type, version_id, model_id, source, file_path)
|
(model_type, version_id, model_id, source, file_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
async def mark_not_downloaded(self, model_type, version_id):
|
async def mark_as_deleted(self, model_type, version_id):
|
||||||
self.marked_not_downloaded.append((model_type, version_id))
|
self.marked_not_downloaded.append((model_type, version_id))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ async def test_download_history_roundtrip_and_manual_override(tmp_path: Path) ->
|
|||||||
assert await service.has_been_downloaded("lora", 101) is True
|
assert await service.has_been_downloaded("lora", 101) is True
|
||||||
assert await service.get_downloaded_version_ids("lora", 11) == [101]
|
assert await service.get_downloaded_version_ids("lora", 11) == [101]
|
||||||
|
|
||||||
await service.mark_not_downloaded("lora", 101)
|
await service.mark_as_deleted("lora", 101)
|
||||||
assert await service.has_been_downloaded("lora", 101) is False
|
assert await service.has_been_downloaded("lora", 101) is False
|
||||||
assert await service.get_downloaded_version_ids("lora", 11) == []
|
assert await service.get_downloaded_version_ids("lora", 11) == []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user