Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change streak counts to terminate on falsey values rather than null #304

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

souponaroom
Copy link
Contributor

Description

Changes some lines in expr.ts to check for any falsey value (or any truthy value) rather than the explicit presence of null. This allows users to define true/false frontmatter tags, with false not counting towards a streak. This is how Obsidian handles checkbox properties, so it fixes issues concerning those too.

Fixes # (issue)
#299 #291

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • If this is a bug fix, did you add or update a test file to the examples directory that verifies the bug is fixed?

@souponaroom
Copy link
Contributor Author

Right before preparing this PR, I just noticed that @lazyguru responded to a previous message I made in #291 ensuring me that he would work on this instead. But by then I already wrote this up, so sorry if I either made @lazyguru or myself do unnecessary work. I will figure out how to turn on emails for git threads in the future.

@lazyguru
Copy link
Collaborator

No worries. I only began investigating. Will review your PR today

Copy link
Collaborator

@lazyguru lazyguru left a comment

Choose a reason for hiding this comment

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

Looks good. I also tested everything locally and appears everything is still working with this change. Nice work!

@@ -167,7 +167,7 @@ const fnMapDatasetToValue: FnMapDatasetToValue = {
let streak = 0;
let maxStreak = 0;
for (let dataPoint of dataset) {
if (dataPoint.value !== null) {
if (dataPoint.value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

And this is why I "love" typescript (sarcasm). dataPoint.value is supposed to be a number field, however in reality Obsidian is passing in booleans as well.

@lazyguru lazyguru merged commit 775f7ad into pyrochlore:master Jan 19, 2024
@lazyguru
Copy link
Collaborator

Thanks for your contribution. I'll do a release a little later this evening

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