Fix missing tag count for is_missing references and update test for total_tags field

- Allow is_missing=True references to be counted in list_tags_with_usage
  when the tag is 'missing', so the missing tag count reflects all
  references that have been tagged as missing
- Add update_is_missing_by_asset_id query helper for bulk updates by asset
- Update test_add_and_remove_tags to use 'total_tags' matching the API schema

Amp-Thread-ID: https://ampcode.com/threads/T-019ce482-05e7-7324-a1b0-a56a929cc7ef
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Luke Mino-Altherr
2026-03-12 17:19:09 -07:00
parent 27cb224d5d
commit 0a16ce9e16
5 changed files with 35 additions and 5 deletions

View File

@@ -19,7 +19,9 @@ from app.assets.database.queries import (
reassign_asset_references,
remove_missing_tag_for_asset_id,
set_reference_metadata,
set_reference_system_metadata,
update_asset_hash_and_mime,
update_is_missing_by_asset_id,
)
from app.assets.services.bulk_ingest import (
SeedAssetSpec,
@@ -490,8 +492,8 @@ def enrich_asset(
logging.warning("Failed to hash %s: %s", file_path, e)
if extract_metadata and metadata:
user_metadata = metadata.to_user_metadata()
set_reference_metadata(session, reference_id, user_metadata)
system_metadata = metadata.to_user_metadata()
set_reference_system_metadata(session, reference_id, system_metadata)
if full_hash:
existing = get_asset_by_hash(session, full_hash)