From 5ac3fb55142d2172f9bb39ab09419ae348da4a47 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 25 Apr 2020 18:45:27 +1000 Subject: [PATCH] handle negative due numbers when gathering existing cards --- rslib/src/storage/notetype/existing_cards.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rslib/src/storage/notetype/existing_cards.sql b/rslib/src/storage/notetype/existing_cards.sql index 110c80f8b..5f4658e05 100644 --- a/rslib/src/storage/notetype/existing_cards.sql +++ b/rslib/src/storage/notetype/existing_cards.sql @@ -17,8 +17,8 @@ select when 0 then ( case odue - when 0 then due - else odue + when 0 then max(0, due) + else max(odue, 0) end ) else null