Commit bf0255bd authored by Dave Griffiths's avatar Dave Griffiths
Browse files

added delete to all review items

parent ab324be2
......@@ -569,7 +569,7 @@
(if (number? (ktv-value ktv))
(number->string (ktv-value ktv))
(ktv-value ktv)) "numeric"
(lambda (v)
(lambda (v)
(entity-set-value! (ktv-key ktv) (ktv-type ktv) v) '()))))
(else (mtext "" (string-append (ktv-type ktv) " not handled")) '()))))
'()
......@@ -596,7 +596,20 @@
(lambda (v)
(cond
((eqv? v 1) (list))
(else (list)))))))))))))))
(else (list)))))))))))
(mbutton (string-append uid "-delete") "Delete"
(lambda ()
(list
(alert-dialog
"mongoose-item-delete"
"Are you sure you want to delete this?"
(lambda (v)
(cond
((eqv? v 1)
(entity-set-value! "deleted" "int" 1)
(entity-update-values!)
(list (finish-activity 0)))
(else (list))))))))))))
(define (review-item-build)
......
......@@ -87,9 +87,13 @@
(let ((de (db-select
db (string-append
"select e.entity_id, e.entity_type, e.unique_id, e.dirty, e.version from " table "_entity as e "
"left join stream_value_varchar "
"left join " table "_value_varchar "
"as p on p.entity_id = e.entity_id and p.attribute_id = 'parent' "
"where e.dirty = 1 and p.value is NULL or p.value='not-set'"))))
"join " table "_value_int "
"as d on d.entity_id = e.entity_id and d.attribute_id = 'deleted' "
"where e.dirty = 1 and p.value is NULL or p.value='not-set' "
"and d.value = 0 "
))))
(if (null? de)
'()
(map
......@@ -106,9 +110,12 @@
(let ((de (db-select
db (string-append
"select e.entity_id, e.entity_type, e.unique_id, e.dirty, e.version from " table "_entity as e "
"left join stream_value_varchar "
"left join " table "_value_varchar "
"as p on p.entity_id = e.entity_id and p.attribute_id = 'parent' "
"where e.dirty=1 and (p.value = ? or e.unique_id = ?);") parent parent)))
"join " table "_value_int "
"as d on d.entity_id = e.entity_id and d.attribute_id = 'deleted' "
"where e.dirty=1 and (p.value = ? or e.unique_id = ?) and d.value=0;")
parent parent)))
(if (null? de)
'()
(map
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment