c6p / logseq-habit-tracker

Habit tracker for Logseq
MIT License
95 stars 5 forks source link

Count child blocks #16

Open jpjpjp opened 2 years ago

jpjpjp commented 2 years ago

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?

c6p commented 2 years ago

@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.

jpjpjp commented 2 years ago

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: @.***>