Commit 42e1bb74 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

getting ready 2

parent e4d5ddfd
......@@ -34,6 +34,11 @@
"mate-guard"
))
(define download-entity-types
(list
"pup-focal"
))
(define pup-focal-export
(list
"pup-focal-nearest"
......@@ -658,7 +663,7 @@
(lambda ()
(msg "connected, going in...")
(append
(list (toast "sync-cb"))
(list (toast "Syncing..."))
(upload-dirty db)
;; important - don't receive until all are sent...
(if (or (have-dirty? db "sync")
......
......@@ -523,7 +523,7 @@
(lambda (fragment arg)
;; in case we come back from weights...
(msg "frag start:" (get-current 'group-composition-id #f))
(entity-init! db "stream" "group-composition"
(entity-init! db "stream" "group-comp"
(get-entity-by-unique db "stream" (get-current 'group-composition-id #f)))
(append
......@@ -569,14 +569,14 @@
(next-button "gc-weigh-" "Go to pregnancies, have you finished here?" "gc-start" "gc-preg"
(lambda ()
;; reset main entity
(entity-init! db "stream" "group-composition"
(entity-init! db "stream" "group-comp"
(get-entity-by-unique db "stream" (get-current 'group-composition-id #f)))
'()))))
(lambda (fragment arg)
(activity-layout fragment))
(lambda (fragment arg)
(entity-init! db "stream" "weight" '())
(entity-init! db "stream" "group-comp-weight" '())
(append
(list
(populate-grid-selector
......@@ -585,28 +585,28 @@
(lambda (individual)
;; search for a weight for this individual...
(let ((s (db-filter
db "stream" "weight"
db "stream" "group-comp-weight"
(list (list "parent" "varchar" "=" (get-current 'group-composition-id 0))
(list "id-mongoose" "varchar" "=" (ktv-get individual "unique_id"))))))
(if (null? s)
;; not there, make a new one
(entity-init&save! db "stream" "weight"
(entity-init&save! db "stream" "group-comp-weight"
(list
(ktv "name" "varchar" "")
(ktv "weight" "real" 0)
(ktv "accurate" "int" 0)
(ktv "parent" "varchar" (get-current 'group-composition-id 0))
(ktv "id-mongoose" "varchar" (ktv-get individual "unique_id"))))
(entity-init! db "stream" "weight" (car s)))
(entity-init! db "stream" "group-comp-weight" (car s)))
(append
(list
(update-widget 'edit-text (get-id "gc-weigh-weight") 'text
(if (null? s) "" (ktv-get (car s) "weight")))
(update-widget 'toggle-button (get-id "gc-weigh-accurate") 'checked
(if (null? s) 0 (ktv-get (car s) "accurate"))))
(update-selector-colours "gc-weigh-choose" "weight" (list "weight" "real" "!=" 0)))))))
(update-selector-colours "gc-weigh-choose" "group-comp-weight" (list "weight" "real" "!=" 0)))))))
(update-grid-selector-enabled "gc-weigh-choose" (get-current 'gc-not-present '()))
(update-selector-colours "gc-weigh-choose" "weight" (list "weight" "real" "!=" 0))))
(update-selector-colours "gc-weigh-choose" "group-comp-weight" (list "weight" "real" "!=" 0))))
(lambda (fragment) '())
(lambda (fragment) '())
(lambda (fragment) '())
......@@ -668,14 +668,14 @@
(next-button "gc-pup-assoc-" "Going to oestrus, have you finished here?" "gc-preg" "gc-oestrus"
(lambda ()
;; reset main entity
(entity-init! db "stream" "group-composition"
(entity-init! db "stream" "group-comp"
(get-entity-by-unique db "stream" (get-current 'group-composition-id #f)))
'()))))
(lambda (fragment arg)
(activity-layout fragment))
(lambda (fragment arg)
(entity-init! db "stream" "pup-assoc" '())
(entity-init! db "stream" "group-comp-pup-assoc" '())
(append
(list
(populate-grid-selector
......@@ -697,13 +697,13 @@
(lambda (escort-individual)
(msg "escort-individual clicked")
(let ((s (db-filter
db "stream" "pup-assoc"
db "stream" "group-comp-pup-assoc"
(list (list "parent" "varchar" "=" (get-current 'group-composition-id 0))
(list "id-escort" "varchar" "=" (ktv-get escort-individual "unique_id"))
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))))))
(if (null? s)
;; not there, make a new one
(entity-init&save! db "stream" "pup-assoc"
(entity-init&save! db "stream" "group-comp-pup-assoc"
(list
(ktv "name" "varchar" "")
(ktv "id-escort" "varchar" (ktv-get escort-individual "unique_id"))
......@@ -711,14 +711,14 @@
(ktv "strength" "varchar" "none")
(ktv "parent" "varchar" (get-current 'group-composition-id 0))
(ktv "id-mongoose" "varchar" (ktv-get pup-individual "unique_id"))))
(entity-init! db "stream" "pup-assoc" (car s)))
(entity-init! db "stream" "group-comp-pup-assoc" (car s)))
(append
(list
(update-widget 'spinner (get-id "gc-pup-strength") 'selection (spinner-index list-strength (entity-get-value "strength")))
(update-widget 'spinner (get-id "gc-pup-accuracy") 'selection (spinner-index list-strength (entity-get-value "accurate"))))
(update-selector-colours2
"gc-pup-escort" "pup-assoc"
"gc-pup-escort" "group-comp-pup-assoc"
(list
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))
(list "strength" "varchar" "!=" "none")
......@@ -726,17 +726,17 @@
))))
(update-selector-colours2
"gc-pup-escort" "pup-assoc"
"gc-pup-escort" "group-comp-pup-assoc"
(list
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))
(list "strength" "varchar" "!=" "none")
(list "accurate" "varchar" "!=" "none")))
(update-selector-colours3 "gc-pup-choose" "pup-assoc")
(update-selector-colours3 "gc-pup-choose" "group-comp-pup-assoc")
(update-grid-selector-enabled "gc-pup-escort" (get-current 'gc-not-present '()))
))))
(update-grid-selector-enabled "gc-pup-escort" (get-current 'gc-not-present '()))
(update-grid-selector-enabled "gc-pup-choose" (get-current 'gc-not-present '()))
(update-selector-colours3 "gc-pup-choose" "pup-assoc")
(update-selector-colours3 "gc-pup-choose" "group-comp-pup-assoc")
))
(lambda (fragment) '())
......@@ -779,13 +779,13 @@
(next-button "gc-pup-oestrus-" "Going to babysitters, have you finished here?" "gc-pup-assoc" "gc-babysitting"
(lambda ()
;; reset main entity
(entity-init! db "stream" "group-composition"
(entity-init! db "stream" "group-comp"
(get-entity-by-unique db "stream" (get-current 'group-composition-id #f)))
'()))))
(lambda (fragment arg)
(activity-layout fragment))
(lambda (fragment arg)
(entity-init! db "stream" "mate-guard" '())
(entity-init! db "stream" "group-comp-mate-guard" '())
(append
(list
(populate-grid-selector
......@@ -806,13 +806,13 @@
(db-mongooses-by-pack-adults) #t
(lambda (escort-individual)
(let ((s (db-filter
db "stream" "mate-guard"
db "stream" "group-comp-mate-guard"
(list (list "parent" "varchar" "=" (get-current 'group-composition-id 0))
(list "id-escort" "varchar" "=" (ktv-get escort-individual "unique_id"))
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))))))
(if (null? s)
;; not there, make a new one
(entity-init&save! db "stream" "mate-guard"
(entity-init&save! db "stream" "group-comp-mate-guard"
(list
(ktv "name" "varchar" "")
(ktv "id-escort" "varchar" (ktv-get escort-individual "unique_id"))
......@@ -821,7 +821,7 @@
(ktv "pester" "int" 0)
(ktv "parent" "varchar" (get-current 'group-composition-id 0))
(ktv "id-mongoose" "varchar" (ktv-get pup-individual "unique_id"))))
(entity-init! db "stream" "mate-guard" (car s)))
(entity-init! db "stream" "group-comp-mate-guard" (car s)))
(append
(list
(update-widget 'spinner (get-id "gc-oestrus-strength") 'selection (spinner-index list-strength (entity-get-value "strength")))
......@@ -829,24 +829,24 @@
(update-widget 'toggle-button (get-id "gc-oestrus-pester") 'checked (entity-get-value "pester")))
(update-selector-colours2
"gc-oestrus-guard" "mate-guard"
"gc-oestrus-guard" "group-comp-mate-guard"
(list
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))
(list "strength" "varchar" "!=" "none")
(list "accurate" "varchar" "!=" "none"))))
))))
(update-selector-colours2
"gc-oestrus-guard" "mate-guard"
"gc-oestrus-guard" "group-comp-mate-guard"
(list
(list "id-mongoose" "varchar" "=" (ktv-get pup-individual "unique_id"))
(list "strength" "varchar" "!=" "none")
(list "accurate" "varchar" "!=" "none")))
(update-selector-colours3 "gc-oestrus-female" "mate-guard")
(update-selector-colours3 "gc-oestrus-female" "group-comp-mate-guard")
(update-grid-selector-enabled "gc-oestrus-guard" (get-current 'gc-not-present '()))
))))
(update-grid-selector-enabled "gc-oestrus-guard" (get-current 'gc-not-present '()))
(update-grid-selector-enabled "gc-oestrus-female" (get-current 'gc-not-present '()))
(update-selector-colours3 "gc-oestrus-female" "mate-guard")
(update-selector-colours3 "gc-oestrus-female" "group-comp-mate-guard")
))
(lambda (fragment) '())
......@@ -1052,7 +1052,7 @@
(set-current!
'group-composition-id
(entity-init&save!
db "stream" "group-composition"
db "stream" "group-comp"
(list (ktv "pack" "varchar" (ktv-get (get-current 'pack ()) "unique_id"))
(ktv "group-comp-code" "varchar" "")))))
(list
......@@ -1553,15 +1553,16 @@
(lambda ()
(debug! (string-append "Downloading whole db"))
(append
(foldl
(lambda (e r)
(debug! (string-append "Downloading /sdcard/mongoose/" e ".csv"))
(cons
(http-download
(string-append "getting-" e)
(string-append url "fn=entity-csv&table=stream&type=" e)
(string-append "/sdcard/mongoose/" e ".csv"))
r))
(foldl
(lambda (e r)
(debug! (string-append "Downloading /sdcard/mongoose/" e ".csv"))
(append r
(list
(http-download
(string-append "getting-" e)
(string-append url "fn=entity-csv&table=stream&type=" e)
(string-append "/sdcard/mongoose/" e ".csv"))
)))
(list
(http-download
"getting-db"
......@@ -1569,17 +1570,17 @@
(string-append "/sdcard/mongoose/mongoose.db"))
;; save paranoid backup
(http-download
"getting-db"
"http://192.168.2.1:8889/symbai.db"
(string-append "/sdcard/symbai/backup/symbai-" (date-time->string (date-time)) ".db"))
"getting-backup-db"
"http://192.168.2.1:8888/mongoose.db"
(string-append "/sdcard/mongoose/backup/mongoose-" (date-time->string (date-time)) ".db"))
(http-download
"getting-log"
"http://192.168.2.1:8889/log.txt"
(string-append "/sdcard/symbai/server-log.txt"))
"http://192.168.2.1:8888/log.txt"
(string-append "/sdcard/mongoose/server-log.txt"))
)
entity-types)
(list))))
(list))))
(mbutton2 "sync-export" "Email"
(lambda ()
(debug! "Sending mail")
......@@ -1587,8 +1588,10 @@
(send-mail
""
"From Mongoose2000" "Please find attached your mongoose data"
(cons
"/sdcard/mongoose/mongoose.db"
(append
(list
"/sdcard/mongoose/mongoose.db"
"/sdcard/mongoose/server-log.txt")
(map
(lambda (e)
(string-append "/sdcard/mongoose/" e ".csv"))
......
INDIV SEX PACK BORN LITTER
DF130 F 11 11/10/2008 D0803
DF139 F 11 11/10/2008 D0803
DF169 F 11 12/05/2010 D1002
DF190 F 11 22/10/2011 D1107
DF200 F 11 16/05/2012 D1202
DF201 F 11 16/05/2012 D1202
DF208 F 11 16/05/2012 D1202
DF216 F 11 06/10/2012 D1204
DF222 F 11 26/06/2013 D1302
DF223 F 11 26/06/2013 D1302
DF225 F 11 26/06/2013 D1302
DF226 F 11 26/06/2013 D1302
DM126 M 11 08/05/2008 D0801
DM165 M 11 14/10/2009 D0904
DM168 M 11 28/12/2009 D0905
DM170 M 11 12/05/2010 D1002
DM171 M 11 12/05/2010 D1002
DM179 M 11 23/07/2010 D1003
DM180 M 11 23/07/2010 D1003
DM189 M 11 02/08/2011 D1106
DM192 M 11 22/10/2011 D1107
DM193 M 11 22/10/2011 D1107
DM194 M 11 22/10/2011 D1107
DM198 M 11 16/05/2012 D1202
DM202 M 11 16/05/2012 D1202
DM203 M 11 16/05/2012 D1202
DM204 M 11 16/05/2012 D1202
DM206 M 11 16/05/2012 D1202
DM209 M 11 16/05/2012 D1202
DM212 M 11 06/10/2012 D1204
DM213 M 11 06/10/2012 D1204
DM215 M 11 06/10/2012 D1204
DM220 M 11 16/04/2013 D1301
DM224 M 11 26/06/2013 D1302
VM107 M 14 28/07/2009 V0904
YF011 F 14 22/08/2013
YF097 F 14 16/11/2010 Y1004
YM096 M 14 16/11/2010 Y1004
UF019 F 15 01/08/2011 U1103
VF033 F 15 26/04/2006
VF137 F 15 15/10/2012 V1203
VF138 F 15 27/04/2013 V1301
VF139 F 15 19/08/2013
VF140 F 15 19/08/2013
VF141 F 15 19/08/2013
VF142 F 15 19/08/2013
VF143 F 15 19/08/2013
VM096 M 15 09/10/2008 V0803
VM123 M 15 01/11/2010 V1005
VM135 M 15 15/10/2012 V1203
VM136 M 15 15/10/2012 V1203
HM069 M 17 31/10/2003 H0304
HM092 M 17 19/04/2005 H0502
SF017 F 17 23/08/2010
SF024 F 17 13/07/2011
SF034 F 17 05/11/2012 S1205
SF038 F 17 05/11/2012 S1205
SF041 F 17 26/04/2013 S1301
SF045 F 17 26/04/2013 S1301
SM009 M 17 15/09/2008 S0804
SM013 M 17 15/09/2008 S0804
SM018 M 17 23/08/2010
SM021 M 17 11/05/2011 S1101
SM028 M 17 09/09/2011 S1102
SM037 M 17 05/11/2012 S1205
SM039 M 17 05/11/2012 S1205
UM020 M 18 01/08/2011 U1103
BF473 F 1B 22/01/2010 B1001
BF484 F 1B 07/05/2010 B1003
BF487 F 1B 07/05/2010 B1003
BF535 F 1B 02/07/2011 B1103
BF561 F 1B 20/04/2012 B1202
BF566 F 1B 20/04/2012 B1202
BF585 F 1B 27/06/2012 B1203
BF589 F 1B 27/06/2012 B1203
BF593 F 1B 17/09/2012 B1204
BF616 F 1B 03/07/2013 B1304
BF617 F 1B 03/07/2013 B1304
BF619 F 1B 03/07/2013 B1304
BF621 F 1B 03/07/2013 B1304
BF622 F 1B 03/07/2013 B1304
BF624 F 1B 03/07/2013 B1304
BF625 F 1B 03/07/2013 B1304
BF627 F 1B 03/07/2013 B1304
BM216 M 1B 27/03/2004 B0402
BM310 M 1B 20/07/2006 B0604
BM410 M 1B 15/09/2008 B0805
BM436 M 1B 25/03/2009 B0902A
BM438 M 1B 25/03/2009 B0902A
BM455 M 1B 20/06/2009 B0903
BM500 M 1B 09/12/2010 B1006
BM558 M 1B 20/04/2012 B1202
BM559 M 1B 20/04/2012 B1202
BM562 M 1B 20/04/2012 B1202
BM564 M 1B 20/04/2012 B1202
BM580 M 1B 27/06/2012 B1203
BM609 M 1B 29/04/2013 B1303
BM614 M 1B 03/07/2013 B1304
BM615 M 1B 03/07/2013 B1304
BM618 M 1B 03/07/2013 B1304
BM620 M 1B 03/07/2013 B1304
BM623 M 1B 03/07/2013 B1304
BM626 M 1B 03/07/2013 B1304
HF125 F 1H 30/11/2006 H0605
HF178 F 1H 14/10/2008 H0804
HF182 F 1H 12/03/2009 H0901
HF220 F 1H 10/11/2010 H1004
HF240 F 1H 23/04/2012 H1202
HF242 F 1H 23/04/2012 H1202
HF248 F 1H 27/06/2012 H1203
HF251 F 1H 27/06/2012 H1203
HF260 F 1H 06/06/2013 H1303
HF261 F 1H 06/06/2013 H1303
HM117 M 1H 17/05/2006 H0602
HM180 M 1H 14/10/2008 H0804
HM195 M 1H 18/12/2009 H0905
HM216 M 1H 10/11/2010 H1004
HM217 M 1H 10/11/2010 H1004
HM222 M 1H 10/11/2010 H1004
HM223 M 1H 10/11/2010 H1004
HM241 M 1H 23/04/2012 H1202
HM243 M 1H 23/04/2012 H1202
HM246 M 1H 23/04/2012 H1202
HM253 M 1H 27/06/2012 H1203
TF249 F 2 02/10/2008 T0804
TF284 F 2 24/06/2010 T1003
TF285 F 2 24/06/2010 T1003
TF297 F 2 21/04/2012 T1202
TF298 F 2 21/04/2012 T1202
TF299 F 2 21/04/2012 T1202
TF319 F 2 06/07/2012 T1203
TF321 F 2 06/07/2012 T1203
TF322 F 2 06/07/2012 T1203
TF332 F 2 26/01/2013 T1301
TF334 F 2 26/01/2013 T1301
TF336 F 2 26/01/2013 T1301
TM233 M 2 30/07/2008 T0803
TM236 M 2 02/10/2008 T0804
TM272 M 2 02/02/2010 T1001
TM279 M 2 15/04/2010 T1002
TM283 M 2 24/06/2010 T1003
TM286 M 2 24/06/2010 T1003
TM300 M 2 21/04/2012 T1202
TM304 M 2 21/04/2012 T1202
TM307 M 2 21/04/2012 T1202
TM309 M 2 21/04/2012 T1202
TM312 M 2 21/04/2012 T1202
TM317 M 2 06/07/2012 T1203
TM323 M 2 06/07/2012 T1203
TM335 M 2 26/01/2013 T1301
TM339 M 2 08/04/2013 T1302
TP355 P 2 28/09/2013 T1305
TP356 P 2 28/09/2013 T1305
TP357 P 2 28/09/2013 T1305
TP358 P 2 28/09/2013 T1305
TP359 P 2 28/09/2013 T1305
TP360 P 2 28/09/2013 T1305
TP361 P 2 28/09/2013 T1305
TP362 P 2 28/09/2013 T1305
TP363 P 2 28/09/2013 T1305
FF166 F 4B 10/01/2010 F1001
FF196 F 4B 28/10/2011 F1104
FM176 M 4B 06/12/2010
FM178 M 4B 06/12/2010
FM188 M 4B 07/04/2011
FM191 M 4B 07/04/2011
FM199 M 4B 18/02/2013 F1301
FF165 F 4E 10/01/2010 F1001
FF187 F 4E 07/04/2011
FF190 F 4E 07/04/2011
MM002 M 4E 27/03/2012
MM004 M 4E 22/08/2012
GF092 F 7A 06/04/2011 G1101
GF093 F 7A 06/04/2011 G1101
GF096 F 7A 12/07/2011 G1102
GF100 F 7A 22/10/2011 G1103
GF106 F 7A 16/06/2012 G1201
GF118 F 7A 22/04/2013 G1301
GM035 M 7A 12/05/2006 G0602
GM049 M 7A 22/10/2007
GM060 M 7A 05/05/2009 G0902
GM061 M 7A 05/05/2009 G0902
GM065 M 7A 23/07/2009 G0903
GM080 M 7A 26/04/2010 G1002
GM082 M 7A 26/04/2010 G1002
GM087 M 7A 28/11/2010 G1004
GM089 M 7A 28/11/2010 G1004
GM090 M 7A 06/04/2011 G1101
GM097 M 7A 12/07/2011 G1102
GM099 M 7A 22/10/2011 G1103
GM105 M 7A 16/06/2012 G1201
GM110 M 7A 01/12/2012 G1203
GM111 M 7A 01/12/2012 G1203
GM112 M 7A 01/12/2012 G1203
GM114 M 7A 01/12/2012 G1203
GM115 M 7A 01/12/2012 G1203
GM117 M 7A 22/04/2013 G1301
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