Skip to content

Commit

Permalink
Merge branch 'issue-4980' of https://github.com/specify/specify7 into…
Browse files Browse the repository at this point in the history
… issue-4980
  • Loading branch information
acwhite211 committed Sep 9, 2024
2 parents 8a2ba88 + 0432501 commit fba9587
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion specifyweb/workbench/upload/treerecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _filter_target_rank_columns(self, ranks_columns_in_row_not_null, target_rank
"""
Filter ranks_columns_in_row_not_null to only include columns that are part of the target treedef
"""

return list(
filter(
lambda rank_column: rank_column.treedef_id == target_rank_treedef_id,
Expand Down Expand Up @@ -392,6 +392,15 @@ def check_root(root):
if result:
return result

# Determine the target treedef based on the columns that are not null
targeted_treedefids = set([rank_column.treedef_id for rank_column in ranks_columns_in_row_not_null])
if targeted_treedefids is None or len(targeted_treedefids) == 0:
# return self, WorkBenchParseFailure('noRanksInRow', {}, None)
return self, None
elif len(targeted_treedefids) > 1:
logger.warning(f"Multiple treedefs found in row: {targeted_treedefids}")
return self, WorkBenchParseFailure('multipleRanksInRow', {}, list(ranks_columns_in_row_not_null)[0].treedefitem_name)

target_rank_treedef_id = targeted_treedefids.pop()
target_rank_treedef = get_target_rank_treedef(tree_def_model, target_rank_treedef_id)

Expand Down

0 comments on commit fba9587

Please sign in to comment.