{ "id": "170282", "key": "TIMOB-25555", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2017-11-12T20:49:24.000+0000", "priority": null, "labels": [], "versions": [ { "id": "19906", "description": "", "name": "Release 6.3.0", "archived": false, "released": true, "releaseDate": "2017-11-01" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:35.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "When setting a model like in the* changeLevel function* the tableview is updated. The value 111 shows up in the tableview row and in the console.log (model after saving). However, the value 111 is not stored persistently because the old value (4) shows up when the app initiates and the checkDBContent() function is called (see console.log output).\r\n\r\n*databases.js*\r\n\r\n/*\r\n * Adding content to DB (and populating the ListView)\r\n */\r\nfunction addToDB(){\r\n\t/*Alloy.Collections.translations = Alloy.createCollection('translations'); */\r\n\tvar itemsToSave = [\r\n\t{questionid: 1624, difficulty: 4, author:'fddDr. Seuss', title:'vxfdssfGreen Evxcvcxvxggs and Ham'}, {questionid: 525, difficulty: 2, author:'mkhgjghDr. fsfsSeuss', title:'Evxcvcxvxggs and Ham'}\r\n\t];\r\n\tvar f;\r\n\t_.each(itemsToSave, function(item){\r\n \t\tf = Alloy.createModel('translations', item, {silent:true}); //deleting not working the second time\r\n \t$.trans.add(f);\r\n f.save();\r\n\t});\r\n\tvar library1 = $.trans;\r\n\tlibrary1.fetch(); // Grab data from persistent storage\r\n\tconsole.log(\"library \" + JSON.stringify(library1));\r\n}\r\ncheckDB();\r\nfunction checkDB(){\r\n\tvar library = $.trans;\r\n\tlibrary.fetch();\r\n\tconsole.log(\"DB content: \" + JSON.stringify(library)); //loads the old value 4 on startup (should be 111 after clicking changeLevel)\r\n}\r\nfunction changeLevel(){\r\n\tvar model = $.trans.get(\"1624\");\r\n\tmodel.set({difficulty: \"111\"});\r\n\tmodel.save();\r\n\tconsole.log(\"model after saving: \" + JSON.stringify(model)); //correct with 111 as value\r\n}\r\n/*\r\n * Deleting content in DB and deleting the ListView automatically (leaves DB unchanged)\r\n */\r\nfunction clearDB(){\r\n\tconsole.log(\"clearing library\");\r\n\t$.trans.deleteAll();\r\n\tcheckDB();\r\n}\r\n\r\n*databases.xml*\r\n\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\r\n\t\r\n\r\n\r\ntranslations.js (in models)\r\nexports.definition = {\r\n\tconfig: {\r\n\t\tcolumns: {\r\n\t\t \"questionid\": \"real\",\r\n\t\t \"difficulty\": \"real\",\r\n\t\t \"author\": \"text\",\r\n\t\t \"title\": \"text\"\r\n\t\t},\r\n\t\tadapter: {\r\n\t\t\ttype: \"sql\",\r\n\t\t\tcollection_name: \"translations\",\r\n\t\t\tidAttribute : \"questionid\"\r\n\t\t}\r\n\t},\r\n\textendModel: function(Model) {\r\n\t\t_.extend(Model.prototype, {\r\n\t\t\tidAttribute : \"questionid\",\r\n\t\t\t// extended functions and properties go here\t\t\r\n\t\t});\r\n\t\treturn Model;\r\n\t},\r\n\textendCollection: function(Collection) {\r\n\t\t_.extend(Collection.prototype, {\r\n\t\t\t// extended functions and properties go here\r\n\r\n\t\t\t// For Backbone v1.1.2, uncomment the following to override the\r\n\t\t\t// fetch method to account for a breaking change in Backbone.\r\n\t\t\t/*\r\n\t\t\tfetch: function(options) {\r\n\t\t\t\toptions = options ? _.clone(options) : {};\r\n\t\t\t\toptions.reset = true;\r\n\t\t\t\treturn Backbone.Collection.prototype.fetch.call(this, options);\r\n\t\t\t}\r\n\t\t\t*/\r\n\r\n*console.log output:*\r\n\r\n[INFO] : model after saving : {\"questionid\":1624,\"difficulty\"*:111*,\"author\":\"Dr. Seuss\"}\r\n[INFO] : DB content: [{\"questionid\":1624,\"difficulty\":*4*,\"author\":\"fddDr. Seuss\"},{\"questionid\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\"}]\r\n", "attachment": [ { "id": "63585", "filename": "app.zip", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T20:17:45.000+0000", "size": 7121625, "mimeType": "application/zip" }, { "id": "63579", "filename": "Appc change Level.png", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T08:46:02.000+0000", "size": 500913, "mimeType": "image/png" }, { "id": "63581", "filename": "appc info.rtf", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T08:55:03.000+0000", "size": 22257, "mimeType": "text/rtf" } ], "flagged": false, "summary": "Values are not persistently stored in the Database when saving", "creator": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS X El Capitan\r\niOS\r\nSDK 6.3\r\ntested in iOS simulator", "comment": { "comments": [ { "id": "430499", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~mgs@vodes.net],\r\n\r\nThanks for sharing with us. Are you using latest TI SDK builds ? Please share your *appc info* here. It looks like you added *checkDBContent()* just after the *database.xml* file. Is it belongs to another file? It would be better if you can share the complete project and test case so that we can reproduce the issue on our end.\r\n\r\nBest", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-11-13T04:25:57.000+0000", "updated": "2017-11-13T04:25:57.000+0000" }, { "id": "430507", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Mostafizur,\r\n\r\nI am using SDK 6.3. I have added the content of the controller and views files and the translations.js (collection) and a screenshot and the appc info in a text file\r\n", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T08:54:37.000+0000", "updated": "2017-11-13T08:55:53.000+0000" }, { "id": "430535", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Please send the full reproducible code. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-13T19:26:24.000+0000", "updated": "2017-11-13T19:26:24.000+0000" }, { "id": "430542", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi!\r\ni uploaded the zipped app folder. It really is very basic and contains not much more than the files I have mentioned in the ticket.\r\n\r\nI have now added an alternative SQL function in database.js and translations.hs This works now for me and persistently stores the values that I didnt manage to get working with backone.\r\nfunction changeSQL(){\r\n\t$.trans.updateRecord(\"difficulty\",\"49800\",\"1624\"); //works\r\n\tcheckDB();\r\n}", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-13T20:20:53.000+0000", "updated": "2017-11-13T20:20:53.000+0000" }, { "id": "431020", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~mgs@vodes.net],\r\nWe are unable to run your sample project. By running the project the following error is shown:\r\n\r\n{code}\r\n[ERROR] : Script Error Couldn't find module: drupal for architecture: x86_64\r\n[ERROR] : Error: getaddrinfo ENOTFOUND platform.appcelerator.com platform.appcelerator.com:443\r\n at errnoException (dns.js:27:10)\r\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)\r\n---------------------------------------------\r\n at TLSSocket.Readable.on (_stream_readable.js:680:33)\r\n at tickOnSocket (_http_client.js:519:10)\r\n at onSocketNT (_http_client.js:535:5)\r\n at nextTickCallbackWith2Args (node.js:458:9)\r\n at process._tickDomainCallback (node.js:413:17)\r\n---------------------------------------------\r\n at ClientRequest.onSocket (_http_client.js:527:11)\r\n at Agent.addRequest (_http_agent.js:157:9)\r\n at new ClientRequest (_http_client.js:142:16)\r\n at Object.exports.request (http.js:31:10)\r\n at Object.socket.once.exports.request (https.js:182:15)\r\n at Object. (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/pac-proxy-agent/node_modules/agent-base/patch-core.js:52:20)\r\n at Object.request (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/pac-proxy-agent/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js:24:20)\r\n at Request.start (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:748:32)\r\n at Request.end (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:1512:10)\r\n at end (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:561:14)\r\n at Immediate._onImmediate (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:575:7)\r\n at processImmediate [as _immediateCallback] (timers.js:383:17)\r\n[ERROR] : Error: getaddrinfo ENOTFOUND platform.appcelerator.com platform.appcelerator.com:443\r\n at errnoException (dns.js:27:10)\r\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)\r\n---------------------------------------------\r\n at TLSSocket.Readable.on (_stream_readable.js:680:33)\r\n at tickOnSocket (_http_client.js:519:10)\r\n at onSocketNT (_http_client.js:535:5)\r\n at nextTickCallbackWith2Args (node.js:458:9)\r\n at process._tickDomainCallback (node.js:413:17)\r\n---------------------------------------------\r\n at ClientRequest.onSocket (_http_client.js:527:11)\r\n at Agent.addRequest (_http_agent.js:157:9)\r\n at new ClientRequest (_http_client.js:142:16)\r\n at Object.exports.request (http.js:31:10)\r\n at Object.socket.once.exports.request (https.js:182:15)\r\n at Object. (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/pac-proxy-agent/node_modules/agent-base/patch-core.js:52:20)\r\n at Object.request (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/pac-proxy-agent/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js:24:20)\r\n at Request.start (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:748:32)\r\n at Request.end (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:1512:10)\r\n at end (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:561:14)\r\n at Immediate._onImmediate (/Users/sharifabudarda/.appcelerator/install/6.3.0/package/node_modules/request/request.js:575:7)\r\n at processImmediate [as _immediateCallback] (timers.js:383:17)\r\n\r\n\r\n{code}\r\n\r\nAre you using any *drupal* module? Can you please check and attach the workable test code.\r\n\r\nBest", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-11-20T10:30:43.000+0000", "updated": "2017-11-20T10:30:43.000+0000" }, { "id": "431023", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Mostafizur Rahman, \r\n\r\nI thought I uncommented the reference to the Drupal module in alloy.js before I uploaded the zip. It is just the lines in alloy.js that call the drupal library that need to be deleted. Let me know if i should reupload the whole app again.", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-20T10:40:11.000+0000", "updated": "2017-11-20T10:40:11.000+0000" }, { "id": "431136", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Please provide a sample app which only has the issue related components and can be used to reproduce the issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-21T23:30:39.000+0000", "updated": "2017-11-21T23:30:39.000+0000" }, { "id": "431153", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "did you actually look at the files ive uploaded? what components are you talking about? in alloy.js you need to uncomment 3 lines. really i dont care anymore what you do wiht this ticket. there is even a workaround included and i have other things to worry about", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-22T08:04:37.000+0000", "updated": "2017-11-22T08:04:37.000+0000" }, { "id": "431187", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I am testing your sample app and I got the below error when I click on change level\r\n{code}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 8;\r\n[ERROR] : line = 104;\r\n[ERROR] : message = \"undefined is not an object (evaluating 'model.set')\";\r\n[ERROR] : sourceURL = \"file:///Users/sharifabudarda/Library/Developer/CoreSimulator/Devices/8CA64F4F-E600-423A-86D7-E964D50A1150/data/Containers/Bundle/Application/38A81522-1122-49FD-892B-5DC7D267B19B/myalloytest.app/alloy/controllers/databases.js\";\r\n[ERROR] : stack = \"changeLevel@file:///Users/sharifabudarda/Library/Developer/CoreSimulator/Devices/8CA64F4F-E600-423A-86D7-E964D50A1150/data/Containers/Bundle/Application/38A81522-1122-49FD-892B-5DC7D267B19B/myalloytest.app/alloy/controllers/databases.js:104:8\";\r\n[ERROR] : }\r\n{code}\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-22T20:22:08.000+0000", "updated": "2017-11-22T20:22:08.000+0000" }, { "id": "431201", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "hello,\r\n\r\ndid you add content to the database before?\r\n1) click \"add to DB\" and the listivew and DB gets populated\r\n2) then click the \"changeLevel\" (blue). the counter in the listview decreases correctly by one (in the screenshot i tried it with setting the value 111 directly, see uncommented line 35)\r\nnow the problem is that this new value (old value minus 1) is not persistently saved. When you click \"DB content\" the old value appears. Same when you restart the app.", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-23T08:10:44.000+0000", "updated": "2017-11-23T08:10:44.000+0000" }, { "id": "431230", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I add to BD by five times clicking on there and then five times in changelevel. See my log\r\n{code}\r\n[INFO] library [{\"questionid\":1624,\"difficulty\":4,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"},{\"questionid\r\n\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\",\"title\":\"Evxcvcxvxggs and Ham\"}]\r\n[INFO] library [{\"questionid\":1624,\"difficulty\":4,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"},{\"questionid\r\n\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\",\"title\":\"Evxcvcxvxggs and Ham\"}]\r\n[INFO] library [{\"questionid\":1624,\"difficulty\":4,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"},{\"questionid\r\n\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\",\"title\":\"Evxcvcxvxggs and Ham\"}]\r\n[INFO] library [{\"questionid\":1624,\"difficulty\":4,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"},{\"questionid\r\n\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\",\"title\":\"Evxcvcxvxggs and Ham\"}]\r\n[INFO] library [{\"questionid\":1624,\"difficulty\":4,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"},{\"questionid\r\n\":525,\"difficulty\":2,\"author\":\"mkhgjghDr. fsfsSeuss\",\"title\":\"Evxcvcxvxggs and Ham\"}]\r\n[INFO] model after saving: {\"questionid\":1624,\"difficulty\":3,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"}\r\n[INFO] model after saving: {\"questionid\":1624,\"difficulty\":2,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"}\r\n[INFO] model after saving: {\"questionid\":1624,\"difficulty\":1,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"}\r\n[INFO] model after saving: {\"questionid\":1624,\"difficulty\":0,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"}\r\n[INFO] model after saving: {\"questionid\":1624,\"difficulty\":-1,\"author\":\"fddDr. Seuss\",\"title\":\"vxfdssfGreen Evxcvcxvxggs and Ham\"}\r\n{code}\r\n\r\nSeems working fine. I am testing on 6.3.0.GA. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-23T22:34:38.000+0000", "updated": "2017-11-23T22:34:38.000+0000" }, { "id": "431235", "author": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes the saving temporarily is working, but not persistently. when you restart the app the difficulty value should be -1 (based on the log you posted). but it is the original first value. that is the problem", "updateAuthor": { "name": "mgs@vodes.net", "key": "mgs@vodes.net", "displayName": "Markus Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-24T09:25:44.000+0000", "updated": "2017-11-24T09:25:44.000+0000" }, { "id": "431242", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I was able to reproduce the issue with the user guide. I see the dificulty values are not stored permanently. App restart will have the old difficulty value 4. Not the last value -1 as in my last comment. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-11-24T22:45:06.000+0000", "updated": "2017-11-24T22:45:06.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }