Skip to content

Commit d3b87cd

Browse files
authored
Merge pull request #144 from abdnh/fix-overdue
Fix sorting by overdue interval
2 parents 26fa26a + fc03f5e commit d3b87cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

advancedbrowser/advancedbrowser/advanced_fields.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,19 @@ def cOverdueIvl(c, n, t):
145145
if val:
146146
return mw.col.format_timespan(val * 24 * 60 * 60, context=FormatTimeSpanContext.INTERVALS)
147147

148+
148149
srt = (f"""
149-
select
150+
(select
150151
(case
151152
when odid then null
152153
when queue = {QUEUE_TYPE_LRN} then null
153154
when queue = {QUEUE_TYPE_NEW} then null
154155
when type = {CARD_TYPE_NEW} then null
155156
when {mw.col.sched.today} - due <= 0 then null
156157
when (queue = {QUEUE_TYPE_REV} or queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} or (type = {CARD_TYPE_REV} and queue < 0)) then ({mw.col.sched.today} - due)
158+
end
157159
)
158-
where id = c.id asc nulls last""")
160+
from cards where id = c.id) asc nulls last""")
159161

160162
cc = advBrowser.newCustomColumn(
161163
type='coverdueivl',

0 commit comments

Comments
 (0)