Commit 66988f30 authored by Dave Griffiths's avatar Dave Griffiths

default numeric values to -1 and hidden them from display, other minor tweaks

parent 3223600e
......@@ -17,6 +17,8 @@
(msg "dbsync.scm")
(define unset-int 2147483647)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; stuff in memory
......@@ -650,15 +652,20 @@
(define (image-invalid? image-name)
(or (null? image-name)
(not image-name)
(equal? image-name "none")))
(equal? image-name "none")
(equal? image-name "")))
;; fill out the widget from the current entity in the memory store
;; dispatches based on widget type
(define (mupdate widget-type id-symbol key)
(cond
((or (eq? widget-type 'edit-text) (eq? widget-type 'text-view))
(update-widget widget-type (get-symbol-id id-symbol) 'text
(entity-get-value key)))
(let ((v (entity-get-value key)))
(update-widget widget-type (get-symbol-id id-symbol) 'text
;; hide -1 as it represents unset
(if (and (number? v) (eqv? v -1))
""
(entity-get-value key)))))
((eq? widget-type 'toggle-button)
(update-widget widget-type (get-symbol-id id-symbol) 'checked
(entity-get-value key)))
......
......@@ -79,7 +79,16 @@
(list
(ktv "name" "varchar" (mtext-lookup 'default-village-name))
(ktv "block" "varchar" "")
(ktv "district" "varchar" "test")
(ktv "district" "varchar" "")
(ktv "school-closest-access" "varchar" "")
(ktv "hospital-closest-access" "varchar" "")
(ktv "post-office-closest-access" "varchar" "")
(ktv "railway-station-closest-access" "varchar" "")
(ktv "state-bus-service-closest-access" "varchar" "")
(ktv "district-bus-service-closest-access" "varchar" "")
(ktv "panchayat-closest-access" "varchar" "")
(ktv "NGO-closest-access" "varchar" "")
(ktv "market-closest-access" "varchar" "")
(ktv "car" "int" 0)))
(define household-ktvlist
......@@ -101,27 +110,27 @@
(ktv "photo" "file" "")
(ktv "tribe" "varchar" "")
(ktv "subtribe" "varchar" "")
(ktv "child" "int" 0)
(ktv "age" "int" 0)
(ktv "child" "int" -1)
(ktv "age" "int" -1)
(ktv "gender" "varchar" "")
(ktv "literate" "int" 0)
(ktv "education" "varchar" "")
(ktv "head-of-house" "varchar" "")
(ktv "marital-status" "varchar" "")
(ktv "times-married" "int" 0)
(ktv "times-married" "int" -1)
(ktv "id-spouse" "varchar" "")
(ktv "children-living" "int" 0)
(ktv "children-dead" "int" 0)
(ktv "children-together" "int" 0)
(ktv "children-apart" "int" 0)
(ktv "children-living" "int" -1)
(ktv "children-dead" "int" -1)
(ktv "children-together" "int" -1)
(ktv "children-apart" "int" -1)
(ktv "residence-after-marriage" "varchar" "")
(ktv "num-siblings" "int" 0)
(ktv "birth-order" "int" 0)
(ktv "length-time" "int" 0)
(ktv "num-siblings" "int" -1)
(ktv "birth-order" "int" -1)
(ktv "length-time" "int" -1)
(ktv "place-of-birth" "varchar" "")
(ktv "num-residence-changes" "int" 0)
(ktv "village-visits-month" "int" 0)
(ktv "village-visits-year" "int" 0)
(ktv "num-residence-changes" "int" -1)
(ktv "village-visits-month" "int" -1)
(ktv "village-visits-year" "int" -1)
(ktv "occupation-agriculture" "int" 0)
(ktv "occupation-gathering" "int" 0)
(ktv "occupation-labour" "int" 0)
......@@ -138,8 +147,8 @@
(ktv "radio" "int" 0)
(ktv "tv" "int" 0)
(ktv "mobile" "int" 0)
(ktv "visit-market" "int" 0)
(ktv "town-sell" "int" 0)
(ktv "visit-market" "int" -1)
(ktv "town-sell" "int" -1)
(ktv "social-one" "varchar" "")
(ktv "social-one-nickname" "varchar" "")
(ktv "social-one-relationship" "varchar" "")
......@@ -196,8 +205,8 @@
(list
(ktv "name" "varchar" (mtext-lookup 'default-crop-name))
(ktv "unit" "varchar" "unit")
(ktv "used" "real" 0)
(ktv "sold" "real" 0)
(ktv "used" "real" -1)
(ktv "sold" "real" -1)
(ktv "seed" "varchar" "")))
(define child-ktvlist
......@@ -205,7 +214,7 @@
(ktv "name" "varchar" (mtext-lookup 'default-child-name))
(ktv "alive" "int" 1)
(ktv "gender" "varchar" "")
(ktv "age" "int" 0)
(ktv "age" "int" -1)
(ktv "living-at-home" "int" 0)))
......@@ -223,9 +232,9 @@
(append
(cond
((get-current 'sync-on #f)
; (when (zero? (random 10))
; (msg "mangling...")
; (mangle-test! db "sync" entity-types))
;(when (zero? (random 10))
; (msg "mangling...")
; (mangle-test! db "sync" entity-types))
(msg "one")
(set-current! 'upload 0)
(set-current! 'download 0)
......
......@@ -11,7 +11,7 @@
(list 'households (list "Households" "" ))
(list 'individual (list "Individual" "" ))
(list 'individuals (list "Individuals" "" ))
(list 'add-item-to-list (list "0" "" ))
(list 'add-item-to-list (list "+" "" ))
(list 'default-village-name (list "New village" "" ))
(list 'title (list "Symbai" "Symbai" "Symbai" "" ))
(list 'sync (list "Sync" "Sync" "Sync" "" ))
......
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