pyrochlore / obsidian-tracker

A plugin tracks occurrences and numbers in your notes
MIT License
1.35k stars 231 forks source link

invert the logic to track #253

Open jarpolacek opened 1 year ago

jarpolacek commented 1 year ago

I have data that is a Boolean value of 1 and 0. By default, I use the calendar view based on the "month:" command and it will display the days, with a value of 1. Can I invert the logic to display 0? I tried showSelectedValue: false, but that had no effect...

lazyguru commented 1 year ago

Depending on how long you have been tracking, it might be easier to invert what you have been tracking instead.

garbofrogman commented 10 months ago

Seconding this. I'm just getting started setting up my Obsidian habit tracker and would love to see my streaks for avoiding bad habits

garbofrogman commented 10 months ago

@jarpolacek In case you're interested, here's a workaround I came up with using Dataview.

```dataview
CALENDAR date(file.name, "dd-MM-yyyy")
FROM "Daily"
WHERE !badHabit AND !veryBadHabit

This is tailored to my specific notes but just to give you an idea. This takes notes which have the date as their title and fixes the formatting. The notes are stored in the "Daily" folder The calendar is marked as long as the bad habits have a value of null or 0

KonkaBass commented 9 months ago

I think I figured it out

searchType: frontmatter
searchTarget: Bad Habit
folder: Folder/Folder
datasetName: No Bad Thing!
valueShift: -1
penalty: 1
month:

" valueShift: -1 penalty: 1 "

valueshifts the "i did the bad thing" true(1) down to 0, and then having a null value returns a 1 which is the inversion you're wanting for a bad habit. Just make sure you're template's default value for that habit is a null and not false.

Would be nice if there was clearer one-line parameter that can invert a boolean like this. but this works for now.