From: Carl Worth <cworth@cworth.org>
Date: Tue, 15 May 2007 23:34:35 +0000 (-0700)
Subject: Fix state transition to enter mastery stage
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=1df7be08910593c0bdd91489578d094e54e36ad2;p=mnemon

Fix state transition to enter mastery stage

Previously it would only enter the mastery stage when unlearned
became 0, but it would miss entering the stage when unlearned
was already 0 and to_introduce became 0. (That is, if you got
all the newly introduced items right on the first try, you could
then go on to demonstrate mastery of many items without being
credited for them towards the mastery quota.)
---

diff --git a/mnemon.c b/mnemon.c
index 321ab14..a7c4c61 100644
--- a/mnemon.c
+++ b/mnemon.c
@@ -889,13 +889,6 @@ mnemon_handle_response (mnemon_t	*mnemon,
 	    item->score = 1;
 	    mnemon->unlearned--;
 	    printf ("You got it!");
-	    if (mnemon->to_introduce == 0 &&
-		mnemon->unlearned == 0 &&
-		mnemon->to_master == 0)
-	    {
-		mnemon->to_master = 10;
-		mnemon->mastered = 0;
-	    }
 	} else if (item->score < 0) {
 	    printf ("Yes---just give me %d more.",
 		    - item->score);
@@ -925,6 +918,14 @@ mnemon_handle_response (mnemon_t	*mnemon,
 	}
     }
 
+    if (mnemon->to_introduce == 0 &&
+	mnemon->unlearned == 0 &&
+	mnemon->to_master == 0)
+    {
+	mnemon->to_master = 10;
+	mnemon->mastered = 0;
+    }
+
     printf (" ");
     if (mnemon->to_introduce)
 	printf ("%d to come. ", mnemon->to_introduce);