Skip to content

Commit d22ac9c

Browse files
authored
Fix logic to count only if not yet present
1 parent ed02dec commit d22ac9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dandischema/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _add_asset_to_stats(assetmeta: Dict[str, Any], stats: _stats_type) -> None:
315315
# once in some incorrectly named datasets
316316
found: Dict[str, str] = {}
317317
for part in Path(assetmeta["path"]).name.split(".")[0].split("_"):
318-
if found.get("subject") and part.startswith("sub-"):
318+
if not found.get("subject") and part.startswith("sub-"):
319319
found["subject"] = subject = part.split("sub-", 1)[1]
320320
if subject not in stats["subjects"]:
321321
stats["subjects"].append(subject)

0 commit comments

Comments
 (0)