Open
Conversation
brianhelba
commented
Mar 18, 2026
Comment on lines
+558
to
+571
| if data.species is not None: | ||
| if len(data.species) == 1: | ||
| species_id = data.species[0] | ||
| return update_nabat_species( | ||
| species_id, | ||
| data.apiToken, | ||
| annotation.nabat_recording.recording_id, | ||
| annotation.nabat_recording.survey_event_id, | ||
| ) | ||
| else: | ||
| return JsonResponse( | ||
| {"error": "NABat only supports one species per recording annotation."}, | ||
| status=400, | ||
| ) |
Member
Author
There was a problem hiding this comment.
What should this function be returning if data.species is None? This looked like a problem before, but it was being masked from the linter by the try block.
Collaborator
There was a problem hiding this comment.
I believe it should return some sort of error requiring that a specieis Id be there. If I remember correctly NABAT doesn't have a concept of the species annotation being pushed up being empty. They have explicity Species Ids for 'NoId' and 'NOISE' 'NotABat' that are in the species DB list. So I think it should error if no species is indicated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This simplifies views and moves a lot of code out of overly-broad
tryblocks.Please review the docs for
get_object_or_404andget_list_or_404, particularly the ability to use a pre-filteredQuerySet(instead of just aModelclass) for the first argument.