Sort the flashcards

I have used flashcards for a while. When I have 500+ cards, I cannot review all the cards one day, so I have to review part of it. The problem is that the cards at the bottom of the review card set which I left for tomorrow, still seem to be at the bottom of the card set tomorrow. If I cannot review all the cards once, it seems that the bottom part of the card will never be reviewed.
I find that the block of flashcards has a property called ‘card-next-schedule’. So I try to sort the card based on the ‘card-next-schedule’ property using the query. But it seems not working.
E.g.

{{cards    (sort-by card-next-schedule  asc)  }}

I have known how to sort the flashcard by using the advanced query. Below is working.

#+BEGIN_QUERY
{:title [:h2 "My books"]
 :query [:find (pull ?b [*])
:where
[?b :block/properties ?p]
[(get ?p :card-next-schedule) ?t]
]
:result-transform (fn [result]
                      (reverse (sort-by (fn [h]
                                 (get (get h :block/properties) :card-next-schedule)) result)))
}
#+END_QUERY

But I want to view this output with flashcards. So I try this.

{{cards (reverse (sort-by (fn [h]
                                 (get (get h :block/properties) :card-next-schedule)) result))}}

But this does’t work. How can I accomplish that?

2 Likes