Skip to content

Conversation

@annavik
Copy link
Member

@annavik annavik commented Apr 2, 2025

Summary

In this PR we make session info optional for occurrences. See #791 for background.

Screenshots

After the fix, we will display occurrences without a session like this. Also any links to session details are disabled. See https://deploy-preview-794--antenna-preview.netlify.app/projects/84/occurrences/125214 for live example.

Screenshot 2025-04-02 at 13 13 34

@annavik annavik requested a review from mihow April 2, 2025 11:10
@netlify
Copy link

netlify bot commented Apr 2, 2025

Deploy Preview for antenna-preview canceled.

Name Link
🔨 Latest commit e6981f0
🔍 Latest deploy log https://app.netlify.com/sites/antenna-preview/deploys/67ee322baa28a00008c506d0

@mihow
Copy link
Collaborator

mihow commented Apr 3, 2025

Thanks for jumping on this! Now I was able to update all Occurrence queries to be consistent and make our counts match!

image

class OccurrenceQuerySet(models.QuerySet):
def with_detections_count(self) -> models.QuerySet:
class OccurrenceQuerySet(models.QuerySet["Occurrence"]):
def valid(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohamedelabbas1996 I introduced a new queryset method called valid(). Let's begin adding this method to all models and use it in place of all(). We could override all() however this makes is almost impossible to debug or troubleshoot strange instances since you will never see them, even in the Django admin.

@mihow mihow merged commit 78a0cb2 into main Apr 3, 2025
8 checks passed
@mihow mihow deleted the fix/optional-session-info branch April 3, 2025 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants