{"action":"created","issue":{"url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/12","labels_url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/12/comments","events_url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/12/events","html_url":"https://github.com/tucisdev/WavyLeaf_android/issues/12","id":59749055,"number":12,"title":"Locally saved points will not all be uploaded when a connection is available.","user":{"login":"tajobe","id":4847023,"avatar_url":"https://avatars.githubusercontent.com/u/4847023?v=3","gravatar_id":"","url":"https://api.github.com/users/tajobe","html_url":"https://github.com/tajobe","followers_url":"https://api.github.com/users/tajobe/followers","following_url":"https://api.github.com/users/tajobe/following{/other_user}","gists_url":"https://api.github.com/users/tajobe/gists{/gist_id}","starred_url":"https://api.github.com/users/tajobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tajobe/subscriptions","organizations_url":"https://api.github.com/users/tajobe/orgs","repos_url":"https://api.github.com/users/tajobe/repos","events_url":"https://api.github.com/users/tajobe/events{/privacy}","received_events_url":"https://api.github.com/users/tajobe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"tajobe","id":4847023,"avatar_url":"https://avatars.githubusercontent.com/u/4847023?v=3","gravatar_id":"","url":"https://api.github.com/users/tajobe","html_url":"https://github.com/tajobe","followers_url":"https://api.github.com/users/tajobe/followers","following_url":"https://api.github.com/users/tajobe/following{/other_user}","gists_url":"https://api.github.com/users/tajobe/gists{/gist_id}","starred_url":"https://api.github.com/users/tajobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tajobe/subscriptions","organizations_url":"https://api.github.com/users/tajobe/orgs","repos_url":"https://api.github.com/users/tajobe/repos","events_url":"https://api.github.com/users/tajobe/events{/privacy}","received_events_url":"https://api.github.com/users/tajobe/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-03-04T04:31:26Z","updated_at":"2015-03-11T03:38:57Z","closed_at":null,"body":"Due to a quirk with how the local database is implemented, the local points will not always be uploaded. A single point should work fine, but multiple will not because the first(oldest) entry is the one being deleted when a point is uploaded.\r\n\r\nFor example, if you submit points p1 and p2 in that order then connect to a network, point p2 will be uploaded first and p1 will be removed from the database, leaving p2 locally despite that being uploaded and p1 never hits the server.\r\n\r\nConfirmed by enabling airplane mode and submitting 2 points before enabling wifi and restarting the app."},"comment":{"url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/comments/78199809","html_url":"https://github.com/tucisdev/WavyLeaf_android/issues/12#issuecomment-78199809","issue_url":"https://api.github.com/repos/tucisdev/WavyLeaf_android/issues/12","id":78199809,"user":{"login":"tajobe","id":4847023,"avatar_url":"https://avatars.githubusercontent.com/u/4847023?v=3","gravatar_id":"","url":"https://api.github.com/users/tajobe","html_url":"https://github.com/tajobe","followers_url":"https://api.github.com/users/tajobe/followers","following_url":"https://api.github.com/users/tajobe/following{/other_user}","gists_url":"https://api.github.com/users/tajobe/gists{/gist_id}","starred_url":"https://api.github.com/users/tajobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tajobe/subscriptions","organizations_url":"https://api.github.com/users/tajobe/orgs","repos_url":"https://api.github.com/users/tajobe/repos","events_url":"https://api.github.com/users/tajobe/events{/privacy}","received_events_url":"https://api.github.com/users/tajobe/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T03:38:57Z","updated_at":"2015-03-11T03:38:57Z","body":"As it turns out, the initial diagnosis is incorrect. The issue still stands as the first point will **never** be uploaded, but the second will, then remove the first locally. Then a third would be uploaded and remove the second locally. This means there will still be at least 1 lost point every time an upload happens from opening the app or the reminder service.\r\n\r\nThe cause is in UploadActivity, where the uploadPoints method will call cursor.moveToFirst, then cursor.moveToNext in the loop, skipping the first entry."}}