logseq-habit-tracker icon indicating copy to clipboard operation
logseq-habit-tracker copied to clipboard

Count child blocks

Open jpjpjp opened this issue 3 years ago • 2 comments

Really neat plugin! I wonder if there might be a way to count child blocks of a habit instead of the number of elements in a comma separated list after the habit?

I have a daily template for my journal page that looks like this:

- #habit  
	- Exercise  
	- Housework  
	- Coding  
	- Music  
	- Social/Networking  

As the day goes on I add child blocks under each category so for example I might have something like:

- #habit  
	- Exercise 
	    - 20 pushups
	    - ran a mile 
	- Housework 
	    - vacuumed  
	- Coding  
	- Music  
	    - wrote a number 1 hit  
	- Social/Networking  

In the habit tracker it would be cool to see 2 for Exercise, 1 for Housework, 1 for Music and 0 for Coding and Social/Networking, but right now I'll get 1 for each one (or a bigger number if I manually add some arbitrary elements in a comma separated list after the habit)

I realize this isn't how it works so this is definitely an enhancement request! On casual searching I couldn't find a macro that would count child blocks, but even if that existed I think there needs to be something to create that many items in a comma separated list for each habit, no?

jpjpjp avatar Jun 04 '22 22:06 jpjpjp

@jpjpjp nice idea.

Yes, currently only the comma separated list is counted. I will provide alternatives as need arised.

The only problem is "0 for Coding". It would break the existing system. A checkbox to ignore the items with no children may solve it.

I like your system, I'm going to add your example to readme after the implementation.

c6p avatar Jun 05 '22 05:06 c6p

Thanks for considering it!

By the way. You might also consider adding something in the readme that explains that the plug-in adds an icon to Logseq which is used to bring up the tracker. It took me a while to figure that out!

On Sun, Jun 5, 2022 at 1:26 AM Can Altıparmak @.***> wrote:

@jpjpjp https://github.com/jpjpjp nice idea.

Yes, currently only the comma separated list is counted. I will provide alternatives as need arised.

The only problem is "0 for Coding". It would break the existing system. A checkbox to ignore the items with no children may solve it.

I like your system, I'm going to add your example to readme after the implementation.

— Reply to this email directly, view it on GitHub https://github.com/c6p/logseq-habit-tracker/issues/16#issuecomment-1146744881, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABENWAHKGIYPTVXOX5QZ6E3VNQ3ADANCNFSM5X4B3UVA . You are receiving this because you were mentioned.Message ID: @.***>

jpjpjp avatar Jun 06 '22 15:06 jpjpjp