33 lines
1014 B
Common Lisp
33 lines
1014 B
Common Lisp
|
(in-package #:cl-deck-builder2-test)
|
||
|
|
||
|
;; (with-connection
|
||
|
;; (db)
|
||
|
;; (retrieve-all
|
||
|
;; (select (:product-name :buy-price :sell-price)
|
||
|
;; (from :crystal-commerce)
|
||
|
;; (order-by (:desc (:cast (:as :buy-price :integer))))
|
||
|
;; (limit 10))))
|
||
|
|
||
|
(defun fix-null-passcodes ()
|
||
|
(with-connection
|
||
|
(db)
|
||
|
(let ((null-passcode-lst
|
||
|
(retrieve-all
|
||
|
(select :*
|
||
|
(from :crystal-commerce)
|
||
|
(where (:is-null :passcode))))))
|
||
|
(dolist (itm null-passcode-lst)
|
||
|
(let* ((code (getf itm :code))
|
||
|
(result (retrieve-one
|
||
|
(select :*
|
||
|
(from :ygoprodeck-card-sets)
|
||
|
(where (:= :code code))))))
|
||
|
(format t "~A: ~A~%" (getf itm :product-name) result))))))
|
||
|
|
||
|
(if result
|
||
|
(progn
|
||
|
(setf (getf itm :passcode) (getf result :passcode))
|
||
|
(cc-item-update
|
||
|
(apply #'make-cc-item itm))))))
|
||
|
)))
|