Add a done date to done tasks that is query-able

As not all tasks are finished on time it would be valuable to have the done date added to the DB schema of logseq.

One could activate the timetracking feature of logseq to get the latest date tracked (See a query @darwis made here. But that is not something I really need. But I would like to know when a task is done.

I am not entirely sure how the DB schema works exactly but I see that there is a

:block/marker "DONE"}

entry in the block data. If also a :block/marker/done “DATE”} part could be added to store the datetime of the moment a task is set to done that would be great.

I have no idea if it workes like this. Feel free to adjust conform working standards.

If this date could be added to be visible at the moment a task is set to DONE that would be great. So you see in one glance when a task is finished. Currently that is not possible with using the timetracking feature. And I have no need for that.

An extra reason to do not use the timetracking feature as I have tasks that directly go from TODO to DONE without the DOING step. Not sure how timetracking works in that scenario.

Maybe a same logic as with scheduled and deadline might work also. So in the :block/content

Not sure what the consequences are in terms of presentation, quera-ability, ect.

+1

I want query my task with done date

1 Like

It would be great feature.
People keep asking it Query for Tasks done today - #6 by John_Doe

With this feature we can see what was done this day/week/month.
It will allow to build DONE table in kanban board to see progress.

2 Likes

I think there are a number of related feature requests, would be good to gather them all together. Here is one I found:

https://discuss.logseq.com/t/automatically-record-date-when-completing-todos-via-query-in-the-daily-journal/14166

And another one: Add date and reference after DONE

Task completion plugin

Thanks! I’ll be merging the two threads you linked, but not with this post itself as their scopes are a bit different. The other two posts explicitly expressed a wish to link to journals in the bidirectional link format, while this post suggests it may be accomplished via some means similar to scheduled and deadlines (for example something similar to CLOSED: <timestamp> in org-mode, I think).

2 Likes

It does not work correctly, see my FR Please change timestamp format to, e.g., 20230306 · Issue #10 · DimitryDushkin/logseq-plugin-task-check-date · GitHub
There are some other plugin which might help.

But it seems like queering all DONE tasks should be the core functionality, so would be great to have.
Thank you.

Note that this plugin is no longer being maintained. There is also an issue with querying the completion date that was never resolved.

1 Like

UPDATE:: I think the issue (with needing to reindex before querying property dates) may have been fixed?

I’m also interested in this functionality. I like to use my journals for daily standup meetings and a query that returns “completed yesterday” tasks would be very helpful

2 Likes

I had a goal to create a task list that displays either unfinished tasks or tasks completed no earlier than yesterday. I didn’t like that completed tasks immediately disappeared from the list, and you couldn’t see what was done today, depriving you of the satisfaction.

I realized that Dmitry Dushkin’s plugin doesn’t work quite right. It creates a date in the format [[PreferredDateFormat]], but Logseq doesn’t perceive it as a link to the daily log without additional manual editing.

Moreover, it’s inconvenient to work with such a date format. I made some edits so that it always sets the date in the ‘yyyyMMdd’ format. This is the format in which Logseq itself handles dates, including how variables like :today are stored.

And it all works now. Additionally, I hid the “completed” property in Logseq settings, so it looks like it was out of the box.

2 Likes

@Soloqub Could you share this solution? I really need to know when did I finish my tasks

@uclguto
Yes, sure, here it is.

1 Like

In the db version, each status change is recorded and queryable. In other words, done and any other status state have a timestamp. Docs have been updated to mention this - docs/db-version.md at feat/db · logseq/docs · GitHub

@cldwalker I experimented with the DB version (both on test.logseq.com and a self-built version on my laptop). After marking a task as “done,” I can see the “Status history” with an entry like “Done 2025-01-26 17:34” when I click on the time indicator.

So far, so good. However, I can’t figure out how to access the “Status history” with an advanced query. In fact, I’m not even sure what the variable name for “Status history” is, because it doesn’t appear in the (Dev) block data. Have the advanced queries gone through any major changes in the DB version? I’m completely lost with advanced queries today— even some minimal examples aren’t working anymore.

Can you, or anyone else, provide a small advanced query example to retrieve the “Status history”? It doesn’t have to be anything fancy; I just need to get some kind of result back as a starting point for further experimentation. This would be greatly appreciated!

Advanced queries have gone through some changes. See docs/db-version-changes.md at feat/db · logseq/docs · GitHub for some tips. Feel free to send a pull request as you or others come across more changes.

The following advanced query returns task status and its timestamp for a block “b1”:

[:find ?status-title ?created-at
 :where
 [?b :logseq.property.history/block ?bl]
 [?b :logseq.property.history/ref-value ?status-value]
 [?status-value :block/title ?status-title]
 [?b :block/created-at ?created-at]
 [?bl :block/title "b1"]]

Unfortunately this advanced query can’t be rendered in app yet so this is only queryable through scripts. If you’d like property history to be queryable in app, feel free to create a post in the discord #alpha-db-feedback. Here’s what this query looks like for a block that has had four different status states:

2 Likes

Thanks for the example, @cldwalker! I was already interested in exploring the scripting capabilities of database graphs…

I’d love to be able to query property history within the app, but unfortunately, I’m still on the waiting list for the Logseq DB alpha tester program, so I don’t have access to #alpha-db-feedback.

Hopefully, someone else will create a post about it.