{"action":"created","comment":{"url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/comments/124433660","pull_request_review_id":46720845,"id":124433660,"diff_hunk":"@@ -0,0 +1,224 @@\n+ angular.module('emission.main.diary.current', ['ui-leaflet',\n+                                                'ngCordova', \n+                                                'emission.services', \n+                                                'ionic'])\n+\n+.controller('CurrMapCtrl', function($scope, Config, $state, $timeout, $ionicActionSheet,leafletData, Logger, $window) {\n+    \n+  console.log(\"controller CurrMapCtrl called from current.js\");\n+  var db = window.cordova.plugins.BEMUserCache;\n+  MANUAL_INCIDENT = \"manual/incident\";\n+  BACKGROUND_LOCATION = \"background/location\";\n+  $scope.mapCtrl = {}; \n+  var directions = [\"N\", \"NE\", \"E\", \"SE\", \"S\", \"SW\", \"W\", \"NW\"]; \n+\n+  $scope.diary = function() {\n+    console.log('diary', \"in diary\");\n+    $state.go(\"root.main.diary\");\n+  };   \n+\n+  angular.extend($scope.mapCtrl, {\n+    defaults: {\n+    }\n+  });\n+\n+  angular.extend($scope.mapCtrl.defaults, Config.getMapTiles());\n+\n+  console.log(\"mapCtrl\", $scope.mapCtrl);\n+\n+  var date = new Date();\n+  var time = date.toTimeString().split(' ')[0].split(':');\n+\n+  var startTimeFn = function(ts) {\n+    var date = new Date(ts*1000);\n+    var hours = date.getHours();\n+    var minutes = date.getMinutes();\n+    var amOrPm = hours < 12 ? 'AM' : 'PM';\n+    hours = hours % 12;\n+    hours = hours ? hours : 12;\n+    minutes = minutes < 10 ? '0'+ minutes : minutes;\n+    $scope.startTime = hours + ':' + minutes + ' ' + amOrPm;\n+  };\n+\n+  var msToMph = function(ms) {\n+    var cmPerM = 100;\n+    var inchPerCm = 1/2.54;\n+    var footPerInch = 1/12;\n+    var milePerFoot = 1/5280;\n+    var secPerMin = 60;\n+    var minPerHour = 60;\n+    $scope.currSpeedInMph = Math.round(ms*cmPerM*inchPerCm*footPerInch*\n+                            milePerFoot*secPerMin*minPerHour);\n+  };\n+\n+  var degreeToDirection = function(degree) {\n+    var index = Math.floor((degree / 45) + 0.5) % 8;\n+    $scope.currentDirection = directions[index];\n+  };\n+\n+  var refreshTrip = function() {\n+    leafletData.getMap('current').then(function(map) {\n+      return db.getAllSensorData(BACKGROUND_LOCATION);\n+    }).then(function(result) {\n+      console.log(result);\n+      var coordinates = result.map(function(locWrapper, index, locList) {\n+        return [locWrapper.data.longitude, locWrapper.data.latitude];\n+      });\n+      var both = [result[0].data.longitude, result[0].data.latitude];\n+      var bearing = Math.round(result[0].data.bearing);\n+      console.log(bearing);\n+      startTimeFn(result[result.length - 1].data.ts);\n+      msToMph(result[0].data.sensed_speed);\n+      degreeToDirection(bearing);\n+      angular.extend($scope.mapCtrl, { \n+        defaults : {\n+          center: {\n+            lat: both[1],\n+            lng: both[0],\n+            zoom: 15\n+          }\n+        },\n+        markers: {\n+          hereMarker: {\n+            lat: both[1],\n+            lng: both[0],\n+            icon: {\n+              iconUrl: 'img/test.gif',\n+              iconSize: [20, 20],\n+              iconAnchor: [10, 10],\n+              popupAnchor: [0, 0],\n+              shadowSize: [0, 0],\n+              shadowAnchor: [0, 0]\n+            },\n+            iconAngle: bearing,\n+          }\n+        },\n+        geojson: {\n+          data: [\n+            {\n+              type: \"LineString\",\n+              coordinates: coordinates\n+            },\n+          ],\n+        },\n+      });\n+    });\n+    console.log($scope.mapCtrl);\n+  };\n+\n+  $scope.$on('leafletDirectiveMap.current.resize', function(event, data) {\n+        console.log(\"current/map received resize event, invalidating map size\");\n+        data.leafletObject.invalidateSize();\n+  });\n+   \n+  var addSafe = function(marker, ts, map) {","path":"www/js/diary/current.js","position":114,"original_position":114,"commit_id":"0d6981f77e6a58903f2311d06bdb580a207330b0","original_commit_id":"0d6981f77e6a58903f2311d06bdb580a207330b0","user":{"login":"sunil07t","id":17379613,"avatar_url":"https://avatars1.githubusercontent.com/u/17379613?v=3","gravatar_id":"","url":"https://api.github.com/users/sunil07t","html_url":"https://github.com/sunil07t","followers_url":"https://api.github.com/users/sunil07t/followers","following_url":"https://api.github.com/users/sunil07t/following{/other_user}","gists_url":"https://api.github.com/users/sunil07t/gists{/gist_id}","starred_url":"https://api.github.com/users/sunil07t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunil07t/subscriptions","organizations_url":"https://api.github.com/users/sunil07t/orgs","repos_url":"https://api.github.com/users/sunil07t/repos","events_url":"https://api.github.com/users/sunil07t/events{/privacy}","received_events_url":"https://api.github.com/users/sunil07t/received_events","type":"User","site_admin":false},"body":"Also these functions are internal function. Should I make them part of the factory?","created_at":"2017-06-28T01:17:17Z","updated_at":"2017-06-28T01:17:18Z","html_url":"https://github.com/e-mission/e-mission-phone/pull/234#discussion_r124433660","pull_request_url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234","_links":{"self":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/comments/124433660"},"html":{"href":"https://github.com/e-mission/e-mission-phone/pull/234#discussion_r124433660"},"pull_request":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234"}}},"pull_request":{"url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234","id":127690038,"html_url":"https://github.com/e-mission/e-mission-phone/pull/234","diff_url":"https://github.com/e-mission/e-mission-phone/pull/234.diff","patch_url":"https://github.com/e-mission/e-mission-phone/pull/234.patch","issue_url":"https://api.github.com/repos/e-mission/e-mission-phone/issues/234","number":234,"state":"open","locked":false,"title":"Clean current screen","user":{"login":"sunil07t","id":17379613,"avatar_url":"https://avatars1.githubusercontent.com/u/17379613?v=3","gravatar_id":"","url":"https://api.github.com/users/sunil07t","html_url":"https://github.com/sunil07t","followers_url":"https://api.github.com/users/sunil07t/followers","following_url":"https://api.github.com/users/sunil07t/following{/other_user}","gists_url":"https://api.github.com/users/sunil07t/gists{/gist_id}","starred_url":"https://api.github.com/users/sunil07t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunil07t/subscriptions","organizations_url":"https://api.github.com/users/sunil07t/orgs","repos_url":"https://api.github.com/users/sunil07t/repos","events_url":"https://api.github.com/users/sunil07t/events{/privacy}","received_events_url":"https://api.github.com/users/sunil07t/received_events","type":"User","site_admin":false},"body":"- Fixed issues from PR #223 \r\n- Changed current screen UI\r\n- Speed in mph and direction\r\n- Incidents are stored in cache\r\n- Using pacman gif as the coordinate point to test change in direction and distance\r\n- Moved current state config from main.js to diary.js because this version of current is in diary tab\r\n\r\nScreenshot of the current screen UI\r\n<img width=\"375\" alt=\"screen shot 2017-06-27 at 6 13 20 am\" src=\"https://user-images.githubusercontent.com/17379613/27589285-c7cb5538-5aff-11e7-814f-7c1b9db476e2.png\">\r\n","created_at":"2017-06-27T13:09:52Z","updated_at":"2017-06-28T01:17:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dec293829e30283820ff4e84aa28663e6e82ae01","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234/commits","review_comments_url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234/comments","review_comment_url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/e-mission/e-mission-phone/issues/234/comments","statuses_url":"https://api.github.com/repos/e-mission/e-mission-phone/statuses/0d6981f77e6a58903f2311d06bdb580a207330b0","head":{"label":"sunil07t:clean_current_screen","ref":"clean_current_screen","sha":"0d6981f77e6a58903f2311d06bdb580a207330b0","user":{"login":"sunil07t","id":17379613,"avatar_url":"https://avatars1.githubusercontent.com/u/17379613?v=3","gravatar_id":"","url":"https://api.github.com/users/sunil07t","html_url":"https://github.com/sunil07t","followers_url":"https://api.github.com/users/sunil07t/followers","following_url":"https://api.github.com/users/sunil07t/following{/other_user}","gists_url":"https://api.github.com/users/sunil07t/gists{/gist_id}","starred_url":"https://api.github.com/users/sunil07t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunil07t/subscriptions","organizations_url":"https://api.github.com/users/sunil07t/orgs","repos_url":"https://api.github.com/users/sunil07t/repos","events_url":"https://api.github.com/users/sunil07t/events{/privacy}","received_events_url":"https://api.github.com/users/sunil07t/received_events","type":"User","site_admin":false},"repo":{"id":61459600,"name":"e-mission-phone","full_name":"sunil07t/e-mission-phone","owner":{"login":"sunil07t","id":17379613,"avatar_url":"https://avatars1.githubusercontent.com/u/17379613?v=3","gravatar_id":"","url":"https://api.github.com/users/sunil07t","html_url":"https://github.com/sunil07t","followers_url":"https://api.github.com/users/sunil07t/followers","following_url":"https://api.github.com/users/sunil07t/following{/other_user}","gists_url":"https://api.github.com/users/sunil07t/gists{/gist_id}","starred_url":"https://api.github.com/users/sunil07t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunil07t/subscriptions","organizations_url":"https://api.github.com/users/sunil07t/orgs","repos_url":"https://api.github.com/users/sunil07t/repos","events_url":"https://api.github.com/users/sunil07t/events{/privacy}","received_events_url":"https://api.github.com/users/sunil07t/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sunil07t/e-mission-phone","description":null,"fork":true,"url":"https://api.github.com/repos/sunil07t/e-mission-phone","forks_url":"https://api.github.com/repos/sunil07t/e-mission-phone/forks","keys_url":"https://api.github.com/repos/sunil07t/e-mission-phone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sunil07t/e-mission-phone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sunil07t/e-mission-phone/teams","hooks_url":"https://api.github.com/repos/sunil07t/e-mission-phone/hooks","issue_events_url":"https://api.github.com/repos/sunil07t/e-mission-phone/issues/events{/number}","events_url":"https://api.github.com/repos/sunil07t/e-mission-phone/events","assignees_url":"https://api.github.com/repos/sunil07t/e-mission-phone/assignees{/user}","branches_url":"https://api.github.com/repos/sunil07t/e-mission-phone/branches{/branch}","tags_url":"https://api.github.com/repos/sunil07t/e-mission-phone/tags","blobs_url":"https://api.github.com/repos/sunil07t/e-mission-phone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sunil07t/e-mission-phone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sunil07t/e-mission-phone/git/refs{/sha}","trees_url":"https://api.github.com/repos/sunil07t/e-mission-phone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sunil07t/e-mission-phone/statuses/{sha}","languages_url":"https://api.github.com/repos/sunil07t/e-mission-phone/languages","stargazers_url":"https://api.github.com/repos/sunil07t/e-mission-phone/stargazers","contributors_url":"https://api.github.com/repos/sunil07t/e-mission-phone/contributors","subscribers_url":"https://api.github.com/repos/sunil07t/e-mission-phone/subscribers","subscription_url":"https://api.github.com/repos/sunil07t/e-mission-phone/subscription","commits_url":"https://api.github.com/repos/sunil07t/e-mission-phone/commits{/sha}","git_commits_url":"https://api.github.com/repos/sunil07t/e-mission-phone/git/commits{/sha}","comments_url":"https://api.github.com/repos/sunil07t/e-mission-phone/comments{/number}","issue_comment_url":"https://api.github.com/repos/sunil07t/e-mission-phone/issues/comments{/number}","contents_url":"https://api.github.com/repos/sunil07t/e-mission-phone/contents/{+path}","compare_url":"https://api.github.com/repos/sunil07t/e-mission-phone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sunil07t/e-mission-phone/merges","archive_url":"https://api.github.com/repos/sunil07t/e-mission-phone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sunil07t/e-mission-phone/downloads","issues_url":"https://api.github.com/repos/sunil07t/e-mission-phone/issues{/number}","pulls_url":"https://api.github.com/repos/sunil07t/e-mission-phone/pulls{/number}","milestones_url":"https://api.github.com/repos/sunil07t/e-mission-phone/milestones{/number}","notifications_url":"https://api.github.com/repos/sunil07t/e-mission-phone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sunil07t/e-mission-phone/labels{/name}","releases_url":"https://api.github.com/repos/sunil07t/e-mission-phone/releases{/id}","deployments_url":"https://api.github.com/repos/sunil07t/e-mission-phone/deployments","created_at":"2016-06-19T01:28:36Z","updated_at":"2016-06-19T01:28:38Z","pushed_at":"2017-06-27T13:05:18Z","git_url":"git://github.com/sunil07t/e-mission-phone.git","ssh_url":"git@github.com:sunil07t/e-mission-phone.git","clone_url":"https://github.com/sunil07t/e-mission-phone.git","svn_url":"https://github.com/sunil07t/e-mission-phone","homepage":null,"size":20171,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"e-mission:master","ref":"master","sha":"0d9d20f8a6d643251c634933edf1e47e76f9c337","user":{"login":"e-mission","id":10713694,"avatar_url":"https://avatars3.githubusercontent.com/u/10713694?v=3","gravatar_id":"","url":"https://api.github.com/users/e-mission","html_url":"https://github.com/e-mission","followers_url":"https://api.github.com/users/e-mission/followers","following_url":"https://api.github.com/users/e-mission/following{/other_user}","gists_url":"https://api.github.com/users/e-mission/gists{/gist_id}","starred_url":"https://api.github.com/users/e-mission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-mission/subscriptions","organizations_url":"https://api.github.com/users/e-mission/orgs","repos_url":"https://api.github.com/users/e-mission/repos","events_url":"https://api.github.com/users/e-mission/events{/privacy}","received_events_url":"https://api.github.com/users/e-mission/received_events","type":"Organization","site_admin":false},"repo":{"id":50543793,"name":"e-mission-phone","full_name":"e-mission/e-mission-phone","owner":{"login":"e-mission","id":10713694,"avatar_url":"https://avatars3.githubusercontent.com/u/10713694?v=3","gravatar_id":"","url":"https://api.github.com/users/e-mission","html_url":"https://github.com/e-mission","followers_url":"https://api.github.com/users/e-mission/followers","following_url":"https://api.github.com/users/e-mission/following{/other_user}","gists_url":"https://api.github.com/users/e-mission/gists{/gist_id}","starred_url":"https://api.github.com/users/e-mission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-mission/subscriptions","organizations_url":"https://api.github.com/users/e-mission/orgs","repos_url":"https://api.github.com/users/e-mission/repos","events_url":"https://api.github.com/users/e-mission/events{/privacy}","received_events_url":"https://api.github.com/users/e-mission/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/e-mission/e-mission-phone","description":"The frontend (phone) code for the e-mission server","fork":false,"url":"https://api.github.com/repos/e-mission/e-mission-phone","forks_url":"https://api.github.com/repos/e-mission/e-mission-phone/forks","keys_url":"https://api.github.com/repos/e-mission/e-mission-phone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/e-mission/e-mission-phone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/e-mission/e-mission-phone/teams","hooks_url":"https://api.github.com/repos/e-mission/e-mission-phone/hooks","issue_events_url":"https://api.github.com/repos/e-mission/e-mission-phone/issues/events{/number}","events_url":"https://api.github.com/repos/e-mission/e-mission-phone/events","assignees_url":"https://api.github.com/repos/e-mission/e-mission-phone/assignees{/user}","branches_url":"https://api.github.com/repos/e-mission/e-mission-phone/branches{/branch}","tags_url":"https://api.github.com/repos/e-mission/e-mission-phone/tags","blobs_url":"https://api.github.com/repos/e-mission/e-mission-phone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/e-mission/e-mission-phone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/e-mission/e-mission-phone/git/refs{/sha}","trees_url":"https://api.github.com/repos/e-mission/e-mission-phone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/e-mission/e-mission-phone/statuses/{sha}","languages_url":"https://api.github.com/repos/e-mission/e-mission-phone/languages","stargazers_url":"https://api.github.com/repos/e-mission/e-mission-phone/stargazers","contributors_url":"https://api.github.com/repos/e-mission/e-mission-phone/contributors","subscribers_url":"https://api.github.com/repos/e-mission/e-mission-phone/subscribers","subscription_url":"https://api.github.com/repos/e-mission/e-mission-phone/subscription","commits_url":"https://api.github.com/repos/e-mission/e-mission-phone/commits{/sha}","git_commits_url":"https://api.github.com/repos/e-mission/e-mission-phone/git/commits{/sha}","comments_url":"https://api.github.com/repos/e-mission/e-mission-phone/comments{/number}","issue_comment_url":"https://api.github.com/repos/e-mission/e-mission-phone/issues/comments{/number}","contents_url":"https://api.github.com/repos/e-mission/e-mission-phone/contents/{+path}","compare_url":"https://api.github.com/repos/e-mission/e-mission-phone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/e-mission/e-mission-phone/merges","archive_url":"https://api.github.com/repos/e-mission/e-mission-phone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/e-mission/e-mission-phone/downloads","issues_url":"https://api.github.com/repos/e-mission/e-mission-phone/issues{/number}","pulls_url":"https://api.github.com/repos/e-mission/e-mission-phone/pulls{/number}","milestones_url":"https://api.github.com/repos/e-mission/e-mission-phone/milestones{/number}","notifications_url":"https://api.github.com/repos/e-mission/e-mission-phone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/e-mission/e-mission-phone/labels{/name}","releases_url":"https://api.github.com/repos/e-mission/e-mission-phone/releases{/id}","deployments_url":"https://api.github.com/repos/e-mission/e-mission-phone/deployments","created_at":"2016-01-27T22:53:08Z","updated_at":"2017-04-11T22:14:11Z","pushed_at":"2017-06-27T13:09:53Z","git_url":"git://github.com/e-mission/e-mission-phone.git","ssh_url":"git@github.com:e-mission/e-mission-phone.git","clone_url":"https://github.com/e-mission/e-mission-phone.git","svn_url":"https://github.com/e-mission/e-mission-phone","homepage":"https://e-mission.eecs.berkeley.edu","size":20169,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":40,"forks":29,"open_issues":40,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234"},"html":{"href":"https://github.com/e-mission/e-mission-phone/pull/234"},"issue":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/issues/234"},"comments":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/issues/234/comments"},"review_comments":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234/comments"},"review_comment":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/pulls/234/commits"},"statuses":{"href":"https://api.github.com/repos/e-mission/e-mission-phone/statuses/0d6981f77e6a58903f2311d06bdb580a207330b0"}}}}
{"actor":{"display_login":"sunil07t"}}