{"action":"created","comment":{"url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/comments/87441563","pull_request_review_id":8055193,"id":87441563,"diff_hunk":"@@ -0,0 +1,203 @@\n+(function (angular) {\n+    'use strict';\n+    angular.module('znk.infra.znkSession').provider('SessionSrv',\n+        function() {\n+            var subjects;\n+\n+            this.setSessionSubjects = function(_subjects) {\n+                subjects = _subjects;\n+            };\n+\n+            this.$get = function($rootScope, $log, ENV, AuthService, InfraConfigSrv,  StudentContextSrv, TeacherContextSrv,\n+                                 UtilitySrv, SessionSubjectEnumConst, $mdDialog, ActivePanelSrv, SessionsStatusEnum,\n+                                 $window, $timeout, PopUpSrv) {\n+                'ngInject';\n+\n+                function sessionInit(sessionSubject) {\n+                    return {\n+                        appName: ENV.studentAppName.split('_')[0].toUpperCase(),\n+                        sessionGUID: UtilitySrv.general.createGuid(),\n+                        educatorUID: userAuth.uid || 'N/A',\n+                        studentUID: StudentContextSrv.getCurrUid() || 'N/A',\n+                        extendTime: 0,\n+                        startTime: Date.now(),\n+                        duration: null,\n+                        sessionSubject: sessionSubject.id,\n+                        status: SessionsStatusEnum.ACTIVE.enum  //(values: 1 = Active, 0 = Ended)\n+                    };\n+                }\n+                function getKeyByValue(obj, value) {\n+                    for( var prop in obj ) {\n+                        if( obj.hasOwnProperty( prop ) ) {\n+                            if( obj[ prop ] === value ) {\n+                                return prop;\n+                            }\n+                        }\n+                    }\n+                }\n+                function minToUnixTimestamp(min) {\n+                    return min * 60 * 1000;\n+                }\n+                function getPath(param) {\n+                    if (!userAuth) {\n+                        $log.error('Invalid user');\n+                        return;\n+                    }\n+                    var path;\n+                    var educatorUID = isTeacherApp ? userAuth.uid : TeacherContextSrv.getCurrUid();\n+                    var studentUID = isTeacherApp ? StudentContextSrv.getCurrUid() : userAuth.uid;\n+                    switch (param) {\n+                        case 'sessions':\n+                            path = ENV.studentAppName + '/liveSession/' + currLiveSessionsGUID.guid;\n+                            return path;\n+                        case 'student':\n+                            path = ENV.studentAppName + '/users/$$uid/liveSession';\n+                            return path.replace('$$uid', '' + studentUID);\n+                        case 'educator':\n+                            path = ENV.dashboardAppName + '/users/$$uid/liveSession';\n+                            return path.replace('$$uid', '' + educatorUID);\n+                        default:\n+                            return;\n+                    }\n+                }\n+                function saveSession() {\n+                    $log.debug('saveSession, sessionData: ', sessionData);\n+                    var dataToSave = {};\n+                    globalStorageProm.then(function (globalStorage) {\n+                        var studentPath = getPath('student') + '/active';\n+                        var educatorPath = getPath('educator') + '/active';\n+                        var sessionPath = getPath('sessions');\n+                        dataToSave[sessionPath] = sessionData;\n+                        dataToSave[studentPath] = { guid: sessionData.sessionGUID };\n+                        dataToSave[educatorPath] = { guid: sessionData.sessionGUID };\n+                        globalStorage.update(dataToSave);\n+                    });\n+                }\n+                function updateSession() {\n+                    $log.debug('updateSession, sessionData: ', sessionData);\n+                    var dataToSave = {};\n+                    globalStorageProm.then(function (globalStorage) {\n+                        var studentPathActive = getPath('student') + '/active';\n+                        var studentPathArchive = getPath('student') + '/archive/' + sessionData.sessionGUID;\n+                        var educatorPathActive = getPath('educator') + '/active';\n+                        var educatorPathArchive = getPath('educator') + '/archive/' + sessionData.sessionGUID;\n+                        var sessionPath = getPath('sessions');\n+                        dataToSave[sessionPath] = sessionData;\n+                        dataToSave[studentPathArchive] = false;\n+                        dataToSave[educatorPathArchive] = false;","path":"src/components/znkSession/services/znkSession.service.js","position":87,"original_position":87,"commit_id":"6b7d05f693c9d9b15224e99af1a05d0ac7f33b9d","original_commit_id":"6b7d05f693c9d9b15224e99af1a05d0ac7f33b9d","user":{"login":"OfirZinkerz","id":21983129,"avatar_url":"https://avatars.githubusercontent.com/u/21983129?v=3","gravatar_id":"","url":"https://api.github.com/users/OfirZinkerz","html_url":"https://github.com/OfirZinkerz","followers_url":"https://api.github.com/users/OfirZinkerz/followers","following_url":"https://api.github.com/users/OfirZinkerz/following{/other_user}","gists_url":"https://api.github.com/users/OfirZinkerz/gists{/gist_id}","starred_url":"https://api.github.com/users/OfirZinkerz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OfirZinkerz/subscriptions","organizations_url":"https://api.github.com/users/OfirZinkerz/orgs","repos_url":"https://api.github.com/users/OfirZinkerz/repos","events_url":"https://api.github.com/users/OfirZinkerz/events{/privacy}","received_events_url":"https://api.github.com/users/OfirZinkerz/received_events","type":"User","site_admin":false},"body":"ok","created_at":"2016-11-10T17:15:55Z","updated_at":"2016-11-10T17:15:55Z","html_url":"https://github.com/Knowledge-OTP/infra/pull/424#discussion_r87441563","pull_request_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424","_links":{"self":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/comments/87441563"},"html":{"href":"https://github.com/Knowledge-OTP/infra/pull/424#discussion_r87441563"},"pull_request":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424"}}},"pull_request":{"url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424","id":93109012,"html_url":"https://github.com/Knowledge-OTP/infra/pull/424","diff_url":"https://github.com/Knowledge-OTP/infra/pull/424.diff","patch_url":"https://github.com/Knowledge-OTP/infra/pull/424.patch","issue_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/424","number":424,"state":"open","locked":false,"title":"Ofir/act 985","user":{"login":"OfirZinkerz","id":21983129,"avatar_url":"https://avatars.githubusercontent.com/u/21983129?v=3","gravatar_id":"","url":"https://api.github.com/users/OfirZinkerz","html_url":"https://github.com/OfirZinkerz","followers_url":"https://api.github.com/users/OfirZinkerz/followers","following_url":"https://api.github.com/users/OfirZinkerz/following{/other_user}","gists_url":"https://api.github.com/users/OfirZinkerz/gists{/gist_id}","starred_url":"https://api.github.com/users/OfirZinkerz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OfirZinkerz/subscriptions","organizations_url":"https://api.github.com/users/OfirZinkerz/orgs","repos_url":"https://api.github.com/users/OfirZinkerz/repos","events_url":"https://api.github.com/users/OfirZinkerz/events{/privacy}","received_events_url":"https://api.github.com/users/OfirZinkerz/received_events","type":"User","site_admin":false},"body":"add znkSession, It's not complete but it's something.","created_at":"2016-11-10T08:50:00Z","updated_at":"2016-11-10T17:15:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02db57926b7c06b107008d0384177177275c34af","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424/commits","review_comments_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424/comments","review_comment_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/424/comments","statuses_url":"https://api.github.com/repos/Knowledge-OTP/infra/statuses/6b7d05f693c9d9b15224e99af1a05d0ac7f33b9d","head":{"label":"Knowledge-OTP:ofir/ACT-985","ref":"ofir/ACT-985","sha":"6b7d05f693c9d9b15224e99af1a05d0ac7f33b9d","user":{"login":"Knowledge-OTP","id":6382607,"avatar_url":"https://avatars.githubusercontent.com/u/6382607?v=3","gravatar_id":"","url":"https://api.github.com/users/Knowledge-OTP","html_url":"https://github.com/Knowledge-OTP","followers_url":"https://api.github.com/users/Knowledge-OTP/followers","following_url":"https://api.github.com/users/Knowledge-OTP/following{/other_user}","gists_url":"https://api.github.com/users/Knowledge-OTP/gists{/gist_id}","starred_url":"https://api.github.com/users/Knowledge-OTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knowledge-OTP/subscriptions","organizations_url":"https://api.github.com/users/Knowledge-OTP/orgs","repos_url":"https://api.github.com/users/Knowledge-OTP/repos","events_url":"https://api.github.com/users/Knowledge-OTP/events{/privacy}","received_events_url":"https://api.github.com/users/Knowledge-OTP/received_events","type":"Organization","site_admin":false},"repo":{"id":44325496,"name":"infra","full_name":"Knowledge-OTP/infra","owner":{"login":"Knowledge-OTP","id":6382607,"avatar_url":"https://avatars.githubusercontent.com/u/6382607?v=3","gravatar_id":"","url":"https://api.github.com/users/Knowledge-OTP","html_url":"https://github.com/Knowledge-OTP","followers_url":"https://api.github.com/users/Knowledge-OTP/followers","following_url":"https://api.github.com/users/Knowledge-OTP/following{/other_user}","gists_url":"https://api.github.com/users/Knowledge-OTP/gists{/gist_id}","starred_url":"https://api.github.com/users/Knowledge-OTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knowledge-OTP/subscriptions","organizations_url":"https://api.github.com/users/Knowledge-OTP/orgs","repos_url":"https://api.github.com/users/Knowledge-OTP/repos","events_url":"https://api.github.com/users/Knowledge-OTP/events{/privacy}","received_events_url":"https://api.github.com/users/Knowledge-OTP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Knowledge-OTP/infra","description":null,"fork":false,"url":"https://api.github.com/repos/Knowledge-OTP/infra","forks_url":"https://api.github.com/repos/Knowledge-OTP/infra/forks","keys_url":"https://api.github.com/repos/Knowledge-OTP/infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Knowledge-OTP/infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Knowledge-OTP/infra/teams","hooks_url":"https://api.github.com/repos/Knowledge-OTP/infra/hooks","issue_events_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/events{/number}","events_url":"https://api.github.com/repos/Knowledge-OTP/infra/events","assignees_url":"https://api.github.com/repos/Knowledge-OTP/infra/assignees{/user}","branches_url":"https://api.github.com/repos/Knowledge-OTP/infra/branches{/branch}","tags_url":"https://api.github.com/repos/Knowledge-OTP/infra/tags","blobs_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Knowledge-OTP/infra/statuses/{sha}","languages_url":"https://api.github.com/repos/Knowledge-OTP/infra/languages","stargazers_url":"https://api.github.com/repos/Knowledge-OTP/infra/stargazers","contributors_url":"https://api.github.com/repos/Knowledge-OTP/infra/contributors","subscribers_url":"https://api.github.com/repos/Knowledge-OTP/infra/subscribers","subscription_url":"https://api.github.com/repos/Knowledge-OTP/infra/subscription","commits_url":"https://api.github.com/repos/Knowledge-OTP/infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/Knowledge-OTP/infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/Knowledge-OTP/infra/contents/{+path}","compare_url":"https://api.github.com/repos/Knowledge-OTP/infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Knowledge-OTP/infra/merges","archive_url":"https://api.github.com/repos/Knowledge-OTP/infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Knowledge-OTP/infra/downloads","issues_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues{/number}","pulls_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls{/number}","milestones_url":"https://api.github.com/repos/Knowledge-OTP/infra/milestones{/number}","notifications_url":"https://api.github.com/repos/Knowledge-OTP/infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Knowledge-OTP/infra/labels{/name}","releases_url":"https://api.github.com/repos/Knowledge-OTP/infra/releases{/id}","deployments_url":"https://api.github.com/repos/Knowledge-OTP/infra/deployments","created_at":"2015-10-15T15:05:15Z","updated_at":"2016-10-30T13:01:35Z","pushed_at":"2016-11-10T16:24:59Z","git_url":"git://github.com/Knowledge-OTP/infra.git","ssh_url":"git@github.com:Knowledge-OTP/infra.git","clone_url":"https://github.com/Knowledge-OTP/infra.git","svn_url":"https://github.com/Knowledge-OTP/infra","homepage":null,"size":42137,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"zinkerz/dev"}},"base":{"label":"Knowledge-OTP:zinkerz/dev","ref":"zinkerz/dev","sha":"cafe8f16c1c27b8475e0e5d0bda4742f55af2766","user":{"login":"Knowledge-OTP","id":6382607,"avatar_url":"https://avatars.githubusercontent.com/u/6382607?v=3","gravatar_id":"","url":"https://api.github.com/users/Knowledge-OTP","html_url":"https://github.com/Knowledge-OTP","followers_url":"https://api.github.com/users/Knowledge-OTP/followers","following_url":"https://api.github.com/users/Knowledge-OTP/following{/other_user}","gists_url":"https://api.github.com/users/Knowledge-OTP/gists{/gist_id}","starred_url":"https://api.github.com/users/Knowledge-OTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knowledge-OTP/subscriptions","organizations_url":"https://api.github.com/users/Knowledge-OTP/orgs","repos_url":"https://api.github.com/users/Knowledge-OTP/repos","events_url":"https://api.github.com/users/Knowledge-OTP/events{/privacy}","received_events_url":"https://api.github.com/users/Knowledge-OTP/received_events","type":"Organization","site_admin":false},"repo":{"id":44325496,"name":"infra","full_name":"Knowledge-OTP/infra","owner":{"login":"Knowledge-OTP","id":6382607,"avatar_url":"https://avatars.githubusercontent.com/u/6382607?v=3","gravatar_id":"","url":"https://api.github.com/users/Knowledge-OTP","html_url":"https://github.com/Knowledge-OTP","followers_url":"https://api.github.com/users/Knowledge-OTP/followers","following_url":"https://api.github.com/users/Knowledge-OTP/following{/other_user}","gists_url":"https://api.github.com/users/Knowledge-OTP/gists{/gist_id}","starred_url":"https://api.github.com/users/Knowledge-OTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knowledge-OTP/subscriptions","organizations_url":"https://api.github.com/users/Knowledge-OTP/orgs","repos_url":"https://api.github.com/users/Knowledge-OTP/repos","events_url":"https://api.github.com/users/Knowledge-OTP/events{/privacy}","received_events_url":"https://api.github.com/users/Knowledge-OTP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Knowledge-OTP/infra","description":null,"fork":false,"url":"https://api.github.com/repos/Knowledge-OTP/infra","forks_url":"https://api.github.com/repos/Knowledge-OTP/infra/forks","keys_url":"https://api.github.com/repos/Knowledge-OTP/infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Knowledge-OTP/infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Knowledge-OTP/infra/teams","hooks_url":"https://api.github.com/repos/Knowledge-OTP/infra/hooks","issue_events_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/events{/number}","events_url":"https://api.github.com/repos/Knowledge-OTP/infra/events","assignees_url":"https://api.github.com/repos/Knowledge-OTP/infra/assignees{/user}","branches_url":"https://api.github.com/repos/Knowledge-OTP/infra/branches{/branch}","tags_url":"https://api.github.com/repos/Knowledge-OTP/infra/tags","blobs_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Knowledge-OTP/infra/statuses/{sha}","languages_url":"https://api.github.com/repos/Knowledge-OTP/infra/languages","stargazers_url":"https://api.github.com/repos/Knowledge-OTP/infra/stargazers","contributors_url":"https://api.github.com/repos/Knowledge-OTP/infra/contributors","subscribers_url":"https://api.github.com/repos/Knowledge-OTP/infra/subscribers","subscription_url":"https://api.github.com/repos/Knowledge-OTP/infra/subscription","commits_url":"https://api.github.com/repos/Knowledge-OTP/infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/Knowledge-OTP/infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/Knowledge-OTP/infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/Knowledge-OTP/infra/contents/{+path}","compare_url":"https://api.github.com/repos/Knowledge-OTP/infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Knowledge-OTP/infra/merges","archive_url":"https://api.github.com/repos/Knowledge-OTP/infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Knowledge-OTP/infra/downloads","issues_url":"https://api.github.com/repos/Knowledge-OTP/infra/issues{/number}","pulls_url":"https://api.github.com/repos/Knowledge-OTP/infra/pulls{/number}","milestones_url":"https://api.github.com/repos/Knowledge-OTP/infra/milestones{/number}","notifications_url":"https://api.github.com/repos/Knowledge-OTP/infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Knowledge-OTP/infra/labels{/name}","releases_url":"https://api.github.com/repos/Knowledge-OTP/infra/releases{/id}","deployments_url":"https://api.github.com/repos/Knowledge-OTP/infra/deployments","created_at":"2015-10-15T15:05:15Z","updated_at":"2016-10-30T13:01:35Z","pushed_at":"2016-11-10T16:24:59Z","git_url":"git://github.com/Knowledge-OTP/infra.git","ssh_url":"git@github.com:Knowledge-OTP/infra.git","clone_url":"https://github.com/Knowledge-OTP/infra.git","svn_url":"https://github.com/Knowledge-OTP/infra","homepage":null,"size":42137,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"zinkerz/dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424"},"html":{"href":"https://github.com/Knowledge-OTP/infra/pull/424"},"issue":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/issues/424"},"comments":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/issues/424/comments"},"review_comments":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424/comments"},"review_comment":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/pulls/424/commits"},"statuses":{"href":"https://api.github.com/repos/Knowledge-OTP/infra/statuses/6b7d05f693c9d9b15224e99af1a05d0ac7f33b9d"}}}}
{"actor":{"display_login":"OfirZinkerz"}}