diff options
author | Thanos Apollo <[email protected]> | 2024-03-03 02:20:52 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-03-03 02:20:52 +0200 |
commit | 6e576af9a0b4edca1dbd38fd22b3553b15fb727b (patch) | |
tree | 24eca94e225f6fd366c7409271570ca022b58137 /gnosis.el | |
parent | a6a05cc437b940f9b9cf4cc6f0aa6a380976705c (diff) |
Add gnosis-edit-update-deck
- Use gnosis-assert funcs to make error messages descreptive
- Use cl-loop to simplify gnosis-update
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1255,6 +1255,19 @@ Insert deck values `ef-increase', `ef-decrease', `ef-threshold', `failure-factor (unless (or (null value) (numberp value)) (error "Invalid value: %s, %s" value description))) +(cl-defun gnosis-edit-update-deck (&key id name ef-increase ef-decrease ef-threshold failure-factor) + "Update deck with id value of ID." + (gnosis-assert-float-or-nil failure-factor "failure-factor must be a float less than 1" t) + (gnosis-assert-int-or-nil ef-threshold "ef-threshold must be an integer") + (gnosis-assert-number-or-nil ef-increase "ef-increase must be a number") + (cl-loop for (field . value) in + `((ef-increase . ,ef-increase) + (ef-decrease . ,ef-decrease) + (ef-threshold . ,ef-threshold) + (failure-factor . ,failure-factor) + (name . ,name)) + when value + do (gnosis-update 'decks `(= ,field ,value) `(= id ,id)))) (cl-defun gnosis-edit-save-exit (&optional deck-edit (exit-func 'exit-recursive-edit) &rest args) "Save edits and exit. |