summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demo.org32
-rw-r--r--org-fc.el20
2 files changed, 30 insertions, 22 deletions
diff --git a/demo.org b/demo.org
index 3b63a53..1d8ac32 100644
--- a/demo.org
+++ b/demo.org
@@ -1,31 +1,29 @@
#+TITLE: Org-Flashcards Demo File
+#+FILETAGS: fc-demo
* Normal Card :fc:
:PROPERTIES:
:ID: 9f80ab65-dbff-41b3-902f-0e8e177debbe
-:FC_CREATED: [2019-01-03 Fri 17:47]
+:FC_CREATED: 2000-01-01T00:00:00Z
:FC_TYPE: normal
:END:
:REVIEW_DATA:
-| position | ease | box | interval | due |
-|----------+------+-----+----------+---------------------|
+| position | ease | box | interval | due |
+|----------+------+-----+----------+----------------------|
| front | 2.50 | 7 | 203.25 | 2000-01-01T00:00:00Z |
:END:
Front of the card
** Back
-:PROPERTIES:
-:ID: 1a9a5308-119c-4398-a715-da3b87d1c7e1
-:END:
Back of the card
* Compact Double Card :fc:
:PROPERTIES:
:ID: d3e290c2-a7f0-4d10-9a0a-6c1ecec3c29e
-:FC_CREATED: [2019-01-03 Fri 17:47]
+:FC_CREATED: 2000-01-01T00:00:00Z
:FC_TYPE: double
:END:
:REVIEW_DATA:
-| position | ease | box | interval | due |
-|----------+------+-----+----------+---------------------|
+| position | ease | box | interval | due |
+|----------+------+-----+----------+----------------------|
| front | 2.50 | 7 | 219.03 | 2000-01-01T00:00:00Z |
| back | 2.50 | 6 | 94.52 | 2000-01-01T00:00:00Z |
:END:
@@ -34,29 +32,29 @@ considered as the back side.
* Cloze Deletion :fc:
:PROPERTIES:
:ID: 2ffc8b34-b2b5-4472-9295-714b5422679d
-:FC_CREATED: [2019-01-03 Fri 17:47]
+:FC_CREATED: 2000-01-01T00:00:00Z
:FC_TYPE: cloze
:FC_CLOZE_MAX: 1
:FC_CLOZE_TYPE: deletion
:END:
:REVIEW_DATA:
-| position | ease | box | interval | due |
-|----------+------+-----+----------+---------------------|
+| position | ease | box | interval | due |
+|----------+------+-----+----------+----------------------|
| 0 | 2.50 | 6 | 89.34 | 2000-01-01T00:00:00Z |
| 1 | 2.50 | 7 | 216.60 | 2000-01-01T00:00:00Z |
:END:
A {{cloze deletion}@0} can have multiple {{holes}@1}.
* Cloze Enumeration :fc:
:PROPERTIES:
-:FC_CREATED: [2019-01-03 Fri 17:48]
+:FC_CREATED: 2000-01-01T00:00:00Z
:FC_TYPE: cloze
:ID: 5eac5801-0ef5-4957-a818-e3f9f08a7d59
:FC_CLOZE_MAX: 3
:FC_CLOZE_TYPE: enumeration
:END:
:REVIEW_DATA:
-| position | ease | box | interval | due |
-|----------+------+-----+----------+---------------------|
+| position | ease | box | interval | due |
+|----------+------+-----+----------+----------------------|
| 0 | 2.50 | 6 | 80.76 | 2000-01-01T00:00:00Z |
| 1 | 2.50 | 6 | 72.76 | 2000-01-01T00:00:00Z |
| 2 | 2.50 | 6 | 91.28 | 2000-01-01T00:00:00Z |
@@ -78,8 +76,8 @@ Enumerations are useful for
:ID: ae675e11-e003-4057-b6b1-1f4702837502
:END:
:REVIEW_DATA:
-| position | ease | box | interval | due |
-|----------+------+-----+----------+---------------------|
+| position | ease | box | interval | due |
+|----------+------+-----+----------+----------------------|
| 0 | 2.50 | 3 | 6.00 | 2000-01-01T00:00:00Z |
| 1 | 2.50 | 2 | 1.00 | 2000-01-01T00:00:00Z |
| 2 | 2.50 | 3 | 6.00 | 2000-01-01T00:00:00Z |
diff --git a/org-fc.el b/org-fc.el
index f78743a..e672ac1 100644
--- a/org-fc.el
+++ b/org-fc.el
@@ -97,6 +97,14 @@ Used to generate absolute paths to the awk scripts.")
:type 'string
:group 'org-fc)
+(defcustom org-fc-demo-tag "fc-demo"
+ "Tag for marking headlines as demo flashcards.
+When demo flashcards are reviewed, their review data is not
+updated. This is used for the `org-fc-demo' and for testing card
+types."
+ :type 'string
+ :group 'org-fc)
+
(defcustom org-fc-review-data-drawer "REVIEW_DATA"
"Name of the drawer used to store review data."
:type 'string
@@ -1712,11 +1720,13 @@ POSITION identify the position that was reviewed, RATING is a
review rating and DELTA the time in seconds between showing and
rating the card."
(org-fc-with-point-at-entry
- (let* ((data (org-fc-get-review-data))
- (current (assoc position data #'string=)))
- (unless current
- (error "No review data found for this position"))
- (unless (and (boundp 'org-fc-demo-mode) org-fc-demo-mode)
+ ;; If the card is marked as a demo card, don't log its reviews and
+ ;; don't update its review data
+ (unless (member org-fc-demo-tag (org-get-tags))
+ (let* ((data (org-fc-get-review-data))
+ (current (assoc position data #'string=)))
+ (unless current
+ (error "No review data found for this position"))
(let ((ease (string-to-number (cl-second current)))
(box (string-to-number (cl-third current)))
(interval (string-to-number (cl-fourth current))))