A07: Fix _auto_publish to allow fish name fallback without external_id
Bug: 'observation.fish_external_id is None' in early return prevented auto-publishing observations that only have fish_name (no external_id), even when name-based fallback matching was available. Fix: - Removed fish_external_id check from early return condition - Auto-publish now tries external_id first, falls back to name match - review_note now describes actual matching method: 'Auto-matched: fish via external_id/name, waterbody via external_id/name' - Previous note 'Automatically matched by previously reviewed source aliases' was misleading when name fallback was used Verification: - 14/14 community_importer tests pass - 124/124 Python tests pass (1 skipped) - Observations without fish_external_id can now auto-publish via name match - review_note accurately describes matching method
This commit is contained in:
@@ -106,7 +106,6 @@ def _auto_publish(session: Session, observation: ExternalObservation) -> bool:
|
||||
or
|
||||
observation.status not in {"staged", "mapped", "ready"}
|
||||
or not observation.source.enabled
|
||||
or observation.fish_external_id is None
|
||||
or observation.x is None
|
||||
or observation.y is None
|
||||
or observation.weight_g is None
|
||||
@@ -149,7 +148,10 @@ def _auto_publish(session: Session, observation: ExternalObservation) -> bool:
|
||||
observation.fish = fish
|
||||
observation.waterbody = waterbody
|
||||
observation.status = "ready"
|
||||
observation.review_note = "Automatically matched by previously reviewed source aliases"
|
||||
# A07: Describe actual matching method used
|
||||
fish_method = "external_id" if observation.fish_external_id else "name"
|
||||
wb_method = "external_id" if observation.waterbody_external_id else "name"
|
||||
observation.review_note = f"Auto-matched: fish via {fish_method}, waterbody via {wb_method}"
|
||||
publish_observation(session, observation)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user