diff --git a/src/utils.lisp b/src/utils.lisp index 4c3b553..7d09b37 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -13,7 +13,6 @@ #:set-alert #:get-alert #:get-and-reset-alert - #:bool-to-checkbox #:checkbox-to-bool #:asciify #:slugify) @@ -72,21 +71,12 @@ POST request." (set-alert nil) message)) -(defun bool-to-checkbox (value) - "Converts `VALUE' so it can populate an HTML checkbox. -It is assumed you are converting a SQLite version of a Boolean so -either 1 (true) or 0 (false). If you need a traditional Boolean value, -DO NOT USE THIS FUNCTION." - (cond ((= value 0) "off") - ((null value) "off") - (t "on"))) - (defun checkbox-to-bool (value) "Converts a HTML Checkbox `VALUE' to a Boolean. The `VALUE' will either be 'on' or 'off'. 'Boolean' in this instance is assuming you are using SQLite and need to convert `VALUE' to an integer/number. If you are needing a traditional Boolean value, DO NOT USE THIS FUNCTION." - (cond ((string= "checked" value) +true+) - ((string= "off" value) +false+) + (cond ((or (string= "checked" value) (string= "on" value)) +true+) + ((or (string= "off" value) (null value)) +false+) ((null value) +false+)))