-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query sort by journal date with nlp-date would broken when clicking label for sort #7210
Comments
Possibly related to more fundamental sorting issue in query table view? (I also had an issue with dates in query table view, but did some more testing to find there was an issue with sorting in general.) |
I am currently using the following :result-transform (fn [result]
(reverse (sort-by (fn [h] (get-in h [:block/page :block/journal-day]))
(map (fn [m]
(update m :block/properties (fn [u]
(assoc u :date
(hash-set (get-in m [:block/page :block/original-name])))))) result)
))) This will reverse sort results by journal date (such that more recent ones are on top) and will add a property to the table showing the journal page. Of course it would be nice if this was built-in, but this will do it for now. |
Thanks @danilofaria Do you use that code within an advanced query within the Logseq Markdown file itself? Or is it a piece of external script? Would be great to see how this looks too (assuming it looks different to a normal table) if you have time to take a screenshot. |
@guypursey #+BEGIN_QUERY
{ :query [:find (pull ?b [*])
:where
(block-content ?b "[[Journal]]")
]
:result-transform (fn [result]
(reverse (sort-by (fn [h] (get-in h [:block/page :block/journal-day]))
(map (fn [m]
(update m :block/properties (fn [u]
(assoc u :date
(hash-set (get-in m [:block/page :block/original-name])))))) result)
)))
}
#+END_QUERY |
@danilofaria Thanks for taking the time to add the further explanation and screenshot. Really appreciated. Hoping to look at this at fixing the underlying issue at some point, unless someone gets there before I do. |
Hi, guys! I want to up this bug. It was created at November 2022 and today in Logseq v0.9.1 it is still actual, unfortunately =( In demo I've used this instruction from Query Table section. @Bad3r, does |
@stdword Sorry for the late reply. I just redo a pass on this ticket today. Does enabling nlp-date help the sorting? |
@cnrpman It works now!! 🚀 for v0.9.8 and my iso-date formats (can't recognize is it sorted by dates or by strings) But, I still can't use |
Seems clicking the label for sort would break the namespace. It's not that cool. Also need some E2E coverage following #7708 |
it's also not consistent with tables v2 which is using |
What happened?
Let's say I have a [[Journal]] page I always use as a header in journal entries. If I do a query
{{query [[Journal]]}}
it will show the blocks in the order of journal dates. But if I switch Table view, then the order is completely random.Reproduce the Bug
Add
On multiple dates.
{{query [[Journal]]}}
Expected Behavior
I would expect the rows in the table to be in the same order as when shown as blocks, i.e sorted by appearance in journals by date. However the order in table mode is totally random.
Screenshots
No response
Desktop Platform Information
No response
Mobile Platform Information
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: