support sorting on tags

I don't personally understand it, but some users seem to want it.
This commit is contained in:
Damien Elmes 2020-03-20 18:20:16 +10:00
parent 00d0447ecb
commit 09a76967e7
2 changed files with 2 additions and 0 deletions

View file

@ -42,6 +42,7 @@ pub enum SortKind {
NoteField,
#[serde(rename = "note")]
NoteType,
NoteTags,
CardMod,
CardReps,
CardDue,

View file

@ -51,6 +51,7 @@ fn write_order(sql: &mut String, kind: &SortKind, reverse: bool) -> Result<()> {
}
SortKind::CardLapses => "c.lapses",
SortKind::CardInterval => "c.ivl",
SortKind::NoteTags => "n.tags",
SortKind::CardDeck => "(select v from sort_order where k = c.did)",
SortKind::NoteType => "(select v from sort_order where k = n.mid)",
SortKind::CardTemplate => "(select v from sort_order where k1 = n.mid and k2 = c.ord)",