Open SpazJibo opened 1 year ago
How are you tracking whether or not you did it that day? To highilght what I mean, an example of my Daily Note frontmatter is below.
---
weight: 175
reading: Y
vaping: Y
drinking: N
smoking: N
---
As you can see that I put a value in saying whether or not I did it that day (Y/N probably wasn't the best choice but i started tracking prior to setting up the different graphs with the Tracker Plugin). This led me to running into the same sort of issue you were where the calculations weren't making any sense. After a bunch of digging and getting really frustrated I found a comment where the streak is being calculated by whether or not there is a value there or not. Not what the value is. This is contrast to the month chart where it is using a threshold (default = 0) to determine where if that day should be highlighted.
So in my case, I could have data for everyday, but with only 3-days in a row being where I didn't drink. This would result in the streak being 7 since I have a value for that key on each day of that week. Instead of 3 like I would expect. I was able to find a work around using the textValueMap root parameter to change the days I wanted to count as breaks to null and the days I wanted to be streaks to any value really (I chose 1).
searchType: frontmatter
searchTarget: vaping
folder: Daily Notes
startDate: 2023-07-01
endDate: 2023-07-07
textValueMap:
'[yY]': null
'[nN]': 1
summary:
template: "Max Streak: {{maxStreak()::i}} days\nMax Breaks: {{maxBreaks()::i}} days"
Which results in the below. The month chart is there to show the streaks match up.
Using 0 instead of null results in the streak being 7 days but the calendar view still showing correctly
I hope you see this and it hopefully helps you figure out your issue.
Hi, I tried using your soluction but once I map values to be null i can't do a % of days
This is the example I'm using. Maybe there should be a way to count 0 as breaking a streak w/o having a null value. Here is the summary YML
searchType: frontmatter
searchTarget: gym
folder: Journal/Daily
summary:
template: "Longest Streak: {{maxStreak()}} day(s)\nLongest Breaks: {{maxBreaks()}} day(s)\nLast streak: {{currentStreak()}} day(s)\nTotal: {{sum()/numDaysHavingData()*100}}%"
I've leveraged some of the examples. I'm tracking a habit in my frontmatter on my daily notes. I've only added four values and for some reason the maxstreak is coming back as 6.
With only four of my daily notes set to true the value is coming back as 6.
Example in image with only four days straight having that data.