Commit 09430c80 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

implemented feedback from testing

parent 532d3eab
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="foam.symbai" package="foam.symbai"
android:versionCode="10" android:versionCode="11"
android:versionName="1.0"> android:versionName="1.0">
<application android:label="@string/app_name" <application android:label="@string/app_name"
android:icon="@drawable/logo" android:icon="@drawable/logo"
......
...@@ -106,22 +106,15 @@ ...@@ -106,22 +106,15 @@
(when (not (check-type type value)) (when (not (check-type type value))
(msg "INCORRECT TYPE FOR" key ":" type ":" value)) (msg "INCORRECT TYPE FOR" key ":" type ":" value))
(let ((existing-type (ktv-get-type (get-current 'entity-values '()) key))) ;; save straight to local db every time (checks for modification)
(cond (entity-update-single-value! (list key type value))
((equal? existing-type type)
;; save straight to local db every time (checks for modification) ;; save to memory
(entity-update-single-value! (list key type value)) (set-current!
;; then save to memory 'entity-values
(set-current! (ktv-set
'entity-values (get-current 'entity-values '())
(ktv-set (ktv key type value))))
(get-current 'entity-values '())
(ktv key type value))))
;;
(else
(msg "entity-set-value! - adding new " key "of type" type "to entity")
(entity-add-value-create! key type value))
)))
;; version to check the entity has the key ;; version to check the entity has the key
(define (entity-set-value-mem! key type value) (define (entity-set-value-mem! key type value)
...@@ -192,9 +185,10 @@ ...@@ -192,9 +185,10 @@
(define (entity-update-single-value! ktv) (define (entity-update-single-value! ktv)
(let ((db (get-current 'db #f)) (let ((db (get-current 'db #f))
(table (get-current 'table #f)) (table (get-current 'table #f))
(unique-id (ktv-get (get-current 'entity-values '()) "unique_id"))) (unique-id (ktv-get (get-current 'entity-values '()) "unique_id"))
(previous (ktv-get-whole (get-current 'entity-values '()) (ktv-key ktv))))
(cond (cond
((ktv-eq? (ktv-get-whole (get-current 'entity-values '()) (ktv-key ktv)) ktv) ((and previous (ktv-eq? previous ktv))
(msg "eusv: no change for" (ktv-key ktv))) (msg "eusv: no change for" (ktv-key ktv)))
(unique-id (unique-id
(update-entity db table (entity-id-from-unique db table unique-id) (list ktv))) (update-entity db table (entity-id-from-unique db table unique-id) (list ktv)))
...@@ -707,9 +701,11 @@ ...@@ -707,9 +701,11 @@
((or (eq? widget-type 'edit-text) (eq? widget-type 'text-view)) ((or (eq? widget-type 'edit-text) (eq? widget-type 'text-view))
(let ((v (entity-get-value key))) (let ((v (entity-get-value key)))
(update-widget widget-type (get-symbol-id id-symbol) 'text (update-widget widget-type (get-symbol-id id-symbol) 'text
;; hide -1 as it represents unset (cond
(if (and (number? v) (eqv? v -1)) ;; hide -1 as it represents unset
"" v)))) ((and (number? v) (eqv? v -1)) "")
((not v) "") ;; unset text
(else v)))))
((eq? widget-type 'toggle-button) ((eq? widget-type 'toggle-button)
(update-widget widget-type (get-symbol-id id-symbol) 'checked (update-widget widget-type (get-symbol-id id-symbol) 'checked
(entity-get-value key))) (entity-get-value key)))
...@@ -837,8 +833,7 @@ ...@@ -837,8 +833,7 @@
(mtitle-scale title) (mtitle-scale title)
(button (button
(make-id (string-append (symbol->string title) "-add")) (make-id (string-append (symbol->string title) "-add"))
(mtext-lookup 'add-item-to-list) "+" 40 (layout 100 'wrap-content 1 'centre 5)
40 (layout 100 'wrap-content 1 'centre 5)
(lambda () (lambda ()
(entity-create! (entity-create!
db table entity-type db table entity-type
......
This diff is collapsed.
...@@ -222,6 +222,15 @@ ...@@ -222,6 +222,15 @@
"social-relationship"," Relation"," ",, "social-relationship"," Relation"," ",,
"social-residence"," Residence"," ",, "social-residence"," Residence"," ",,
"social-strength"," Strength"," ",, "social-strength"," Strength"," ",,
"friendship-one"," One"," ",,
"friendship-two"," Two"," ",,
"friendship-three"," Three"," ",,
"friendship-four"," Four"," ",,
"friendship-five"," Five"," ",,
"friendship-nickname","Name",,,
"friendship-relationship"," Relation"," ",,
"friendship-residence"," Residence"," ",,
"friendship-strength"," Strength"," ",,
"mother"," Mother"," ",, "mother"," Mother"," ",,
"father"," Father"," ",, "father"," Father"," ",,
"sister"," Sister"," ",, "sister"," Sister"," ",,
......
...@@ -12,8 +12,20 @@ ...@@ -12,8 +12,20 @@
(list 'agree-playback (list "Play")) (list 'agree-playback (list "Play"))
(list 'photo-agree-record (list "Record")) (list 'photo-agree-record (list "Record"))
(list 'photo-agree-playback (list "Play")) (list 'photo-agree-playback (list "Play"))
(list 'general-agreement-text (list "Blah blah...")) (list 'general-agreement-text (list "General agreement text here..."))
(list 'photo-agreement-text (list "Blah blah...")) (list 'photo-agreement-text (list "Photo agreement text here..."))
(list 'household-agreement-text (list "Household agreement text here..."))
(list 'locality (list "Locality"))
(list 'num-male-adults (list "Num male adults"))
(list 'num-female-adults (list "Num female adults"))
(list 'num-male-children (list "Num male children"))
(list 'num-female-children (list "Num female children"))
(list 'mother-name (list "Mother name"))
(list 'father-name (list "Father name"))
(list 'mother-alive (list "Alive"))
(list 'father-alive (list "Alive"))
(list 'spouse-name (list "Spouse name"))
(list 'spouse-gender (list "Spouse gender"))
(list 'village-notes (list "Notes")) (list 'village-notes (list "Notes"))
(list 'individual-notes (list "Notes")) (list 'individual-notes (list "Notes"))
(list 'household-notes (list "Notes")) (list 'household-notes (list "Notes"))
...@@ -136,7 +148,9 @@ ...@@ -136,7 +148,9 @@
(list 'income-button (list "Income" "" )) (list 'income-button (list "Income" "" ))
(list 'genealogy-button (list "Genealogy" "" )) (list 'genealogy-button (list "Genealogy" "" ))
(list 'social-button (list "Social" "" )) (list 'social-button (list "Social" "" ))
(list 'agreement-button (list "Agreement" "" )) (list 'household-agreement-button (list "Agreement" "" ))
(list 'photo-agreement-button (list "Agreement" "" ))
(list 'general-agreement-button (list "Agreement" "" ))
(list 'is-a-child (list "Child" "" )) (list 'is-a-child (list "Child" "" ))
(list 'change-photo (list "Change photo" "" )) (list 'change-photo (list "Change photo" "" ))
(list 'details-name (list "Name" "Kyrteng" )) (list 'details-name (list "Name" "Kyrteng" ))
...@@ -233,9 +247,15 @@ ...@@ -233,9 +247,15 @@
(list 'social-four (list "Four" "" )) (list 'social-four (list "Four" "" ))
(list 'social-five (list "Five" "" )) (list 'social-five (list "Five" "" ))
(list 'social-nickname (list "Name" )) (list 'social-nickname (list "Name" ))
(list 'social-gender (list "Gender" ))
(list 'social-relationship (list "Relation" "" )) (list 'social-relationship (list "Relation" "" ))
(list 'social-residence (list "Residence" "" )) (list 'social-residence (list "Residence" "" ))
(list 'social-strength (list "Strength" "" )) (list 'social-strength (list "Strength" "" ))
(list 'friendship-one (list "One" "" ))
(list 'friendship-two (list "Two" "" ))
(list 'friendship-three (list "Three" "" ))
(list 'friendship-four (list "Four" "" ))
(list 'friendship-five (list "Five" "" ))
(list 'mother (list "Mother" "" )) (list 'mother (list "Mother" "" ))
(list 'father (list "Father" "" )) (list 'father (list "Father" "" ))
(list 'sister (list "Sister" "" )) (list 'sister (list "Sister" "" ))
......
...@@ -78,10 +78,10 @@ ...@@ -78,10 +78,10 @@
;; order by name ;; order by name
"join " table "_value_varchar " "join " table "_value_varchar "
"as n on n.entity_id = e.entity_id and n.attribute_id = 'name' " "as n on n.entity_id = e.entity_id and n.attribute_id = 'name' "
;; ignore deleted (if exists) ;; ignore deleted
"left join " table "_value_int " "join " table "_value_int "
"as d on d.entity_id = e.entity_id and d.attribute_id = 'deleted' and " "as d on d.entity_id = e.entity_id and d.attribute_id = 'deleted' and "
"d.value = 0 or d.value = NULL ") "d.value = 0 ")
filter) filter)
(if typed "where e.entity_type = ? order by n.value" (if typed "where e.entity_type = ? order by n.value"
"order by n.value"))) "order by n.value")))
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
(let ((s (apply (let ((s (apply
db-select db-select
(append (append
(list db (build-query table filter (not (equal? type "*")))) (list db q)
(build-args filter) (build-args filter)
(if (equal? type "*") '() (list type)))))) (if (equal? type "*") '() (list type))))))
(msg (db-status db)) (msg (db-status db))
......
...@@ -18,26 +18,38 @@ ...@@ -18,26 +18,38 @@
(provide (all-defined-out)) (provide (all-defined-out))
;(define (ktv-get ktv-list key)
; (cond
; ((null? ktv-list) #f)
; ((equal? (ktv-key (car ktv-list)) key)
; (ktv-value (car ktv-list)))
; (else (ktv-get (cdr ktv-list) key))))
(define (ktv-get ktv-list key) (define (ktv-get ktv-list key)
(cond (let ((k (assoc-string-fast key ktv-list)))
((null? ktv-list) #f) (if k (ktv-value k) #f)))
((equal? (ktv-key (car ktv-list)) key)
(ktv-value (car ktv-list))) ;(define (ktv-get-whole ktv-list key)
(else (ktv-get (cdr ktv-list) key)))) ; (cond
; ((null? ktv-list) #f)
; ((equal? (ktv-key (car ktv-list)) key)
; (car ktv-list))
; (else (ktv-get-whole (cdr ktv-list) key))))
(define (ktv-get-whole ktv-list key) (define (ktv-get-whole ktv-list key)
(cond (assoc-string-fast key ktv-list))
((null? ktv-list) #f)
((equal? (ktv-key (car ktv-list)) key) ;(define (ktv-get-type ktv-list key)
(car ktv-list)) ; (cond
(else (ktv-get-whole (cdr ktv-list) key)))) ; ((null? ktv-list) #f)
; ((equal? (ktv-key (car ktv-list)) key)
; (ktv-type (car ktv-list)))
; (else (ktv-get-type (cdr ktv-list) key))))
(define (ktv-get-type ktv-list key) (define (ktv-get-type ktv-list key)
(cond (let ((k (assoc-string-fast key ktv-list)))
((null? ktv-list) #f) (if k (ktv-type k) #f)))
((equal? (ktv-key (car ktv-list)) key)
(ktv-type (car ktv-list)))
(else (ktv-get-type (cdr ktv-list) key))))
(define (ktv-set ktv-list ktv) (define (ktv-set ktv-list ktv)
(cond (cond
......
dave@fulmar.4670:1404729118
\ No newline at end of file
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