Commit 830f56fa authored by Dave Griffiths's avatar Dave Griffiths
Browse files

fixed pregnant after back button and removed loads of debug messages

parent bf0255bd
......@@ -129,7 +129,7 @@
;; used internally
(define (entity-create! db table entity-type ktv-list)
(msg "creating:" entity-type ktv-list)
;(msg "creating:" entity-type ktv-list)
(let ((values
(append
(list
......@@ -139,11 +139,11 @@
(ktv "lon" "real" (cadr (get-current 'location '(0 0))))
(ktv "deleted" "int" 0))
ktv-list)))
(msg "about to insert")
;(msg "about to insert")
(let ((r (insert-entity/get-unique
db table entity-type (get-current 'user-id "no id")
values)))
(msg "entity-create: " entity-type)
;;(msg "entity-create: " entity-type)
r)))
;; updates existing db entity from memory values
......@@ -155,7 +155,7 @@
(unique-id (ktv-get values "unique_id")))
(cond
((and unique-id (not (null? values)))
(msg "entity-update-values inner" values)
;;(msg "entity-update-values inner" values)
(update-entity db table (entity-id-from-unique db table unique-id) values)
;; removed due to save button no longer exiting activity - need to keep!
;;(entity-reset!)
......
......@@ -601,7 +601,8 @@
(define (get-id name)
(let ((r (id-map-get name)))
(cond
((zero? r) (msg "no id found for" name) 0)
((zero? r) ;(msg "no id found for" name)
0)
(else r))))
(define (make-id name)
......
......@@ -332,7 +332,7 @@
(define (update-grid-selector-checked id items-id)
(let ((items-str (entity-get-value items-id)))
(msg "selector-checked for" id items-id items-str)
;;(msg "selector-checked for" id items-id items-str)
(if items-str
(map
(lambda (item)
......@@ -845,12 +845,10 @@
;; hack
(define (update-selector-colours2-or id entity-type where)
(msg "----------------------------------------------**")
(update-grid-selector-colours
id "id-mongoose"
(map
(lambda (i)
(msg "found:" i)
(get-entity db "stream" i))
(let ((s (apply
db-select
......
......@@ -728,6 +728,10 @@
(lambda (fragment arg)
(activity-layout fragment))
(lambda (fragment arg)
;; in case we come back from pup assoc...
(entity-init! db "stream" "group-comp"
(get-entity-by-unique db "stream" (get-current 'group-composition-id #f)))
(append
(list
(populate-grid-selector
......
......@@ -123,9 +123,14 @@ public class starwisp extends StarwispActivity
int day = c.get(Calendar.DAY_OF_MONTH);
int month = c.get(Calendar.MONTH)+1;
int year = c.get(Calendar.YEAR);
int timezone_offset_mins = (c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET)) / 60000;
// pass in a bunch of useful stuff
m_Scheme.eval("(define dirname \"/sdcard/"+dirname+"\")(define date-day "+day+") (define date-month "+month+") (define date-year "+year+")");
m_Scheme.eval("(define dirname \"/sdcard/"+dirname+"\")"+
"(define date-day "+day+")"+
"(define date-month "+month+")"+
"(define date-year "+year+")"+
"(define timezone-offset-mins "+timezone_offset_mins+")");
Log.i("starwisp","started, now running starwisp.scm...");
m_Scheme.eval(m_Scheme.readRawTextFile(this, "starwisp.scm"));
......
......@@ -44,30 +44,30 @@
(define (setup db table)
(msg "db setup")
(db-exec db (string-append "create table " table "_entity ( entity_id integer primary key autoincrement, entity_type varchar(256), unique_id varchar(256), dirty integer, version integer)"))
(db-exec db (string-append "create index if not exists index_" table "_entity on " table "_entity (unique_id)"))
(db-exec db (string-append "create index if not exists index_" table "_entity on " table "_entity (unique_id)"))
(db-exec db (string-append "create table " table "_attribute ( id integer primary key autoincrement, attribute_id varchar(256), entity_type varchar(256), attribute_type varchar(256))"))
(db-exec db (string-append "create index if not exists index_" table "_attribute on " table "_attribute (entity_type)"))
(db-exec db (string-append "create index if not exists index_" table "_attribute on " table "_attribute (entity_type)"))
(db-exec db (string-append "create table " table "_value_varchar ( id integer primary key autoincrement, entity_id integer, attribute_id varchar(255), value varchar(4096), dirty integer, version integer)"))
(upgrade-table db (string-append table "_value_varchar"))
(db-exec db (string-append "create index if not exists index_" table "_value_varchar on " table "_value_varchar (entity_id,attribute_id)"))
(db-exec db (string-append "create index if not exists index_" table "_value_varchar on " table "_value_varchar (entity_id,attribute_id)"))
(db-exec db (string-append "create table " table "_value_int ( id integer primary key autoincrement, entity_id integer, attribute_id varchar(255), value integer, dirty integer, version integer)"))
(upgrade-table db (string-append table "_value_int"))
(db-exec db (string-append "create index if not exists index_" table "_value_int on " table "_value_int (entity_id,attribute_id)"))
(db-exec db (string-append "create index if not exists index_" table "_value_int on " table "_value_int (entity_id,attribute_id)"))
(db-exec db (string-append "create table " table "_value_real ( id integer primary key autoincrement, entity_id integer, attribute_id varchar(255), value real, dirty integer, version integer)"))
(upgrade-table db (string-append table "_value_real"))
(db-exec db (string-append "create index if not exists index_" table "_value_real on " table "_value_real (entity_id,attribute_id)"))
(db-exec db (string-append "create index if not exists index_" table "_value_real on " table "_value_real (entity_id,attribute_id)"))
(db-exec db (string-append "create table " table "_value_file ( id integer primary key autoincrement, entity_id integer, attribute_id varchar(255), value varchar(4096), dirty integer, version integer)"))
(upgrade-table db (string-append table "_value_file"))
(db-exec db (string-append "create index if not exists index_" table "_value_file on " table "_value_file (entity_id,attribute_id)"))
(db-exec db (string-append "create index if not exists index_" table "_value_file on " table "_value_file (entity_id,attribute_id)"))
)
......
......@@ -125,11 +125,11 @@
(let ((q (build-query table filter type)))
(let ((s (apply
db-select
(dbg (append
(append
(list db q)
(build-args filter)
(if (not (equal? type "*")) (list type) '()))))))
(msg (db-status db))
(if (not (equal? type "*")) (list type) '())))))
;;(msg (db-status db))
(if (null? s)
'()
(map
......@@ -148,7 +148,7 @@
(list db (build-query table filter (not (equal? type "*"))))
(build-args filter)
(if (equal? type "*") '() (list type))))))
(msg (db-status db))
;;(msg (db-status db))
(if (null? s)
'()
(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