Skip to content

fix truthiness check; safety check around bin count#476

Merged
joefutrelle merged 1 commit intomasterfrom
fix_dataset_truthiness_check
Oct 22, 2025
Merged

fix truthiness check; safety check around bin count#476
joefutrelle merged 1 commit intomasterfrom
fix_dataset_truthiness_check

Conversation

@mike-kaimika
Copy link
Collaborator

This PR corrects a few minor bugs that were not directly found in the wild, but could be an issue

  • Fix exception through if the length of a dataset (which would be the number of bins) is called on a new dataset that does not have a backing data from the database (e.g., unsaved)
  • Fixes an issue with conditional checks against a dataset. E.g., True if dataset else False. Because len is defined, that is used as truthiness rather than the default on an ORM model, which is to just return True (whether the model is saved or not). The included bool method takes precedence and both corrects the logic, and also prevents accidental usage of len in a conditional statement that would make a database call that might not be expected

@mike-kaimika mike-kaimika self-assigned this Oct 22, 2025
@joefutrelle
Copy link
Contributor

LGTM, good catch

@joefutrelle joefutrelle merged commit 3740eb1 into master Oct 22, 2025
@joefutrelle joefutrelle deleted the fix_dataset_truthiness_check branch October 22, 2025 18:33
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.

2 participants