summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--awk/filter_due.awk8
-rw-r--r--awk/index_positions.awk6
-rw-r--r--org-fc.el34
3 files changed, 16 insertions, 32 deletions
diff --git a/awk/filter_due.awk b/awk/filter_due.awk
deleted file mode 100644
index 0406847..0000000
--- a/awk/filter_due.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN {
- FS="\t";
- now = strftime("%FT%TZ", systime(), 1);
-}
-
-$4 == "0" && $9 < now {
- print $0
-}
diff --git a/awk/index_positions.awk b/awk/index_positions.awk
index 36e9cbe..e409f52 100644
--- a/awk/index_positions.awk
+++ b/awk/index_positions.awk
@@ -1,5 +1,6 @@
BEGIN {
FS="|";
+ now = strftime("%FT%TZ", systime(), 1);
fc_tag = ":" or_default(fc_tag, "fc") ":";
suspended_tag = ":" or_default(suspended_tag, "suspended") ":";
@@ -64,6 +65,9 @@ in_data && /^\|.*\|$/ {
box = trim($4);
interval = trim($5);
due = trim_surrounding($6);
- print FILENAME "\t" id "\t" type "\t" suspended "\t" position "\t" ease "\t" box "\t" interval "\t" due;
+
+ if (!(filter_due == "1") || (due < now && suspended == "0")) {
+ print FILENAME "\t" id "\t" type "\t" suspended "\t" position "\t" ease "\t" box "\t" interval "\t" due "\t" inherited_tags "\t" local_tags;
+ }
}
}
diff --git a/org-fc.el b/org-fc.el
index cb6b87c..b219f8d 100644
--- a/org-fc.el
+++ b/org-fc.el
@@ -1273,30 +1273,14 @@ Each element is parsed using its header specification."
:variables (org-fc-awk--indexer-variables)))
(org-fc-awk--command "awk/stats_cards.awk" :utils t)))))
-;; TODO: Optimize card order for review
(defun org-fc-awk-due-positions-for-paths (paths)
"Generate a list of due positions in PATHS."
- (mapcar
- (lambda (pos)
- (plist-put pos
- :tags
- (org-fc-combine-tags
- (plist-get pos :inherited-tags)
- (plist-get pos :local-tags))))
- (org-fc-tsv-parse
- org-fc-awk-position-headers
- (shell-command-to-string
- (org-fc-awk--pipe
- (org-fc-awk--find paths)
- (org-fc-awk--xargs
- (org-fc-awk--command
- "awk/index_positions.awk"
- :utils t
- :variables (org-fc-awk--indexer-variables)))
- (org-fc-awk--command "awk/filter_due.awk"))))))
+ (org-fc-awk-positions-for-paths paths t))
-(defun org-fc-awk-positions-for-paths (paths)
- "Generate a list of all positions in PATHS."
+(defun org-fc-awk-positions-for-paths (paths &optional filter-due)
+ "Generate a list of all positions in PATHS.
+If FILTER-DUE is non-nil, only list non-suspended cards that are
+due for review."
(mapcar
(lambda (pos)
(plist-put pos
@@ -1313,7 +1297,10 @@ Each element is parsed using its header specification."
(org-fc-awk--command
"awk/index_positions.awk"
:utils t
- :variables (org-fc-awk--indexer-variables))))))))
+ :variables
+ (cons
+ `("filter_due" . ,(if filter-due "1" "0"))
+ (org-fc-awk--indexer-variables)))))))))
(cl-defun org-fc-awk-stats-positions (&optional (paths org-fc-directories))
"Statistics for all positions in PATHS."
@@ -1345,11 +1332,12 @@ Return nil there is no history file."
(defun org-fc-due-positions-for-paths (paths)
"Find due positions for all cards in files in PATHS."
(if (eq org-fc-indexer 'awk)
- (org-fc-shuffle (org-fc-awk-due-positions-for-paths paths))
+ (org-fc-shuffle (org-fc-awk-positions-for-paths paths :filter-due))
(error
'org-fc-indexer-error
(format "Indexer %s not implemented yet" org-fc-indexer))))
+;; TODO: Optimize card order for review
(defun org-fc-due-positions (context)
"Return a shuffled list [(file id position)] of due cards for CONTEXT.
Valid contexts: