{"action":"created","comment":{"url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/comments/28225954","id":28225954,"diff_hunk":"@@ -0,0 +1,167 @@\n+/*!\n+ * Copyright 2015 Digital Services, University of Cambridge Licensed\n+ * under the Educational Community License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance with the\n+ * License. You may obtain a copy of the License at\n+ *\n+ *     http://opensource.org/licenses/ECL-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an \"AS IS\"\n+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+define(['exports'], function(exports) {\n+\n+    // Cache the tripos data\n+    var _triposData = {};\n+\n+\n+    //////////////\n+    //  SERIES  //\n+    //////////////\n+\n+    /**\n+     * Decorate a borrowed series with its parent info\n+     *\n+     * @param  {Object[]}    series    A collection of series\n+     */\n+    var decorateBorrowedSeriesWithParentInfo = exports.decorateBorrowedSeriesWithParentInfo = function(series) {\n+        _.each(series, function(serie) {\n+\n+            // Only decorate borrowed series\n+            /* istanbul ignore else */\n+            if (serie.borrowedFrom) {\n+                _.each(_triposData, function(orgUnitType) {\n+\n+                    // Add the parent info to the organisational unit, if any\n+                    var parent = _.find(orgUnitType, function(orgUnit) { return orgUnit.id === serie.borrowedFrom.ParentId; });\n+                    /* istanbul ignore next */\n+                    if (parent) {\n+                        serie.borrowedFrom.Parent = parent;\n+                    }\n+                });\n+            }\n+        });\n+    };\n+\n+\n+    ////////////////\n+    //  TRIPOSES  //\n+    ////////////////\n+\n+    /**\n+     * Decorate an organisational unit with its parent info\n+     *\n+     * @param  {Object}    orgUnit    The organisational unit that needs to be decorated with his parent info\n+     */\n+    var addParentInfoToOrgUnit = exports.addParentInfoToOrgUnit = function(orgUnit) {\n+        if (orgUnit.ParentId) {\n+            _.each(_triposData, function(_orgUnitType) {\n+\n+                // Add the parent info to the organisational unit, if any\n+                var parent = _.find(_orgUnitType, function(_orgUnit) { return _orgUnit.id === orgUnit.ParentId; });\n+                if (parent) {\n+                    orgUnit.Parent = parent;\n+                }\n+            });\n+        }\n+    };\n+\n+    /**\n+     * Return the tripos structure","path":"shared/gh/js/utils/gh.utils.orgunits.js","position":74,"original_position":74,"commit_id":"05be73c80b5fd665c6cfbb41bfae21f0da227c85","original_commit_id":"05be73c80b5fd665c6cfbb41bfae21f0da227c85","user":{"login":"bp323","id":218391,"avatar_url":"https://avatars.githubusercontent.com/u/218391?v=3","gravatar_id":"","url":"https://api.github.com/users/bp323","html_url":"https://github.com/bp323","followers_url":"https://api.github.com/users/bp323/followers","following_url":"https://api.github.com/users/bp323/following{/other_user}","gists_url":"https://api.github.com/users/bp323/gists{/gist_id}","starred_url":"https://api.github.com/users/bp323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bp323/subscriptions","organizations_url":"https://api.github.com/users/bp323/orgs","repos_url":"https://api.github.com/users/bp323/repos","events_url":"https://api.github.com/users/bp323/events{/privacy}","received_events_url":"https://api.github.com/users/bp323/received_events","type":"User","site_admin":false},"body":"While we're changing this, can you expand on the JSDocs a bit to include what the returned tripos structure object looks like?","created_at":"2015-04-13T09:47:11Z","updated_at":"2015-04-13T09:47:11Z","html_url":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322#discussion_r28225954","pull_request_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322","_links":{"self":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/comments/28225954"},"html":{"href":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322#discussion_r28225954"},"pull_request":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322"}}},"pull_request":{"url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322","id":32421897,"html_url":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322","diff_url":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322.diff","patch_url":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322.patch","issue_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/322","number":322,"state":"open","locked":false,"title":"Borrowing & publishing from non published parts","user":{"login":"Coenego","id":2194396,"avatar_url":"https://avatars.githubusercontent.com/u/2194396?v=3","gravatar_id":"","url":"https://api.github.com/users/Coenego","html_url":"https://github.com/Coenego","followers_url":"https://api.github.com/users/Coenego/followers","following_url":"https://api.github.com/users/Coenego/following{/other_user}","gists_url":"https://api.github.com/users/Coenego/gists{/gist_id}","starred_url":"https://api.github.com/users/Coenego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coenego/subscriptions","organizations_url":"https://api.github.com/users/Coenego/orgs","repos_url":"https://api.github.com/users/Coenego/repos","events_url":"https://api.github.com/users/Coenego/events{/privacy}","received_events_url":"https://api.github.com/users/Coenego/received_events","type":"User","site_admin":false},"body":"This is a placeholder / braindump ticket to handle a couple of (edge) cases around borrowing:\r\n\r\n**Borrowing from the same module in which you would like to borrow**\r\nIn borrowing modal, the current module should be visible, but disabled\r\n\r\n**Publishing a part which has series in it which belong to a part which hasn't been published yet**\r\nAdmins should be able to borrow series from parts which are not published yet, with the principle that unpublished series from other departments shouldn't hold up timetable creation.\r\n\r\nOn the student UI, we could do this to deal with this case:\r\n\r\nUnpublished series should be displayed, but the Add button disabled. If somebody clicks on Add event button, a tooltip could be displayed with the following copy:\r\n\r\nThis {{event_type}} is belongs to {{tripos}} / {{part}} which is not published yet.\r\nYou will be able to add this to your calendar once it is published.\r\n\r\n\r\n\r\n\r\n ","created_at":"2015-04-01T14:05:56Z","updated_at":"2015-04-13T09:47:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a179f04c33ba2b5220642f032ba742421acd5be9","assignee":{"login":"bp323","id":218391,"avatar_url":"https://avatars.githubusercontent.com/u/218391?v=3","gravatar_id":"","url":"https://api.github.com/users/bp323","html_url":"https://github.com/bp323","followers_url":"https://api.github.com/users/bp323/followers","following_url":"https://api.github.com/users/bp323/following{/other_user}","gists_url":"https://api.github.com/users/bp323/gists{/gist_id}","starred_url":"https://api.github.com/users/bp323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bp323/subscriptions","organizations_url":"https://api.github.com/users/bp323/orgs","repos_url":"https://api.github.com/users/bp323/repos","events_url":"https://api.github.com/users/bp323/events{/privacy}","received_events_url":"https://api.github.com/users/bp323/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/milestones/1","html_url":"https://github.com/CUL-DigitalServices/grasshopper-ui/milestones/Beta%20release","labels_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/milestones/1/labels","id":1007640,"number":1,"title":"Beta release","description":"This should be a feature complete release with only minor and visual issues, publicly accessible and testable by end users. Hosted by CARET controlled cloud infrastructure, on the current QA server instance.","creator":{"login":"oszkarnagy","id":117483,"avatar_url":"https://avatars.githubusercontent.com/u/117483?v=3","gravatar_id":"","url":"https://api.github.com/users/oszkarnagy","html_url":"https://github.com/oszkarnagy","followers_url":"https://api.github.com/users/oszkarnagy/followers","following_url":"https://api.github.com/users/oszkarnagy/following{/other_user}","gists_url":"https://api.github.com/users/oszkarnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/oszkarnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oszkarnagy/subscriptions","organizations_url":"https://api.github.com/users/oszkarnagy/orgs","repos_url":"https://api.github.com/users/oszkarnagy/repos","events_url":"https://api.github.com/users/oszkarnagy/events{/privacy}","received_events_url":"https://api.github.com/users/oszkarnagy/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":42,"state":"open","created_at":"2015-03-05T14:32:49Z","updated_at":"2015-04-10T13:46:19Z","due_on":"2015-04-27T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322/commits","review_comments_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322/comments","review_comment_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/322/comments","statuses_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/statuses/05be73c80b5fd665c6cfbb41bfae21f0da227c85","head":{"label":"Coenego:issue-322-parts","ref":"issue-322-parts","sha":"05be73c80b5fd665c6cfbb41bfae21f0da227c85","user":{"login":"Coenego","id":2194396,"avatar_url":"https://avatars.githubusercontent.com/u/2194396?v=3","gravatar_id":"","url":"https://api.github.com/users/Coenego","html_url":"https://github.com/Coenego","followers_url":"https://api.github.com/users/Coenego/followers","following_url":"https://api.github.com/users/Coenego/following{/other_user}","gists_url":"https://api.github.com/users/Coenego/gists{/gist_id}","starred_url":"https://api.github.com/users/Coenego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coenego/subscriptions","organizations_url":"https://api.github.com/users/Coenego/orgs","repos_url":"https://api.github.com/users/Coenego/repos","events_url":"https://api.github.com/users/Coenego/events{/privacy}","received_events_url":"https://api.github.com/users/Coenego/received_events","type":"User","site_admin":false},"repo":{"id":26270317,"name":"grasshopper-ui","full_name":"Coenego/grasshopper-ui","owner":{"login":"Coenego","id":2194396,"avatar_url":"https://avatars.githubusercontent.com/u/2194396?v=3","gravatar_id":"","url":"https://api.github.com/users/Coenego","html_url":"https://github.com/Coenego","followers_url":"https://api.github.com/users/Coenego/followers","following_url":"https://api.github.com/users/Coenego/following{/other_user}","gists_url":"https://api.github.com/users/Coenego/gists{/gist_id}","starred_url":"https://api.github.com/users/Coenego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coenego/subscriptions","organizations_url":"https://api.github.com/users/Coenego/orgs","repos_url":"https://api.github.com/users/Coenego/repos","events_url":"https://api.github.com/users/Coenego/events{/privacy}","received_events_url":"https://api.github.com/users/Coenego/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Coenego/grasshopper-ui","description":"Grasshopper UI","fork":true,"url":"https://api.github.com/repos/Coenego/grasshopper-ui","forks_url":"https://api.github.com/repos/Coenego/grasshopper-ui/forks","keys_url":"https://api.github.com/repos/Coenego/grasshopper-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Coenego/grasshopper-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Coenego/grasshopper-ui/teams","hooks_url":"https://api.github.com/repos/Coenego/grasshopper-ui/hooks","issue_events_url":"https://api.github.com/repos/Coenego/grasshopper-ui/issues/events{/number}","events_url":"https://api.github.com/repos/Coenego/grasshopper-ui/events","assignees_url":"https://api.github.com/repos/Coenego/grasshopper-ui/assignees{/user}","branches_url":"https://api.github.com/repos/Coenego/grasshopper-ui/branches{/branch}","tags_url":"https://api.github.com/repos/Coenego/grasshopper-ui/tags","blobs_url":"https://api.github.com/repos/Coenego/grasshopper-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Coenego/grasshopper-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Coenego/grasshopper-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/Coenego/grasshopper-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Coenego/grasshopper-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/Coenego/grasshopper-ui/languages","stargazers_url":"https://api.github.com/repos/Coenego/grasshopper-ui/stargazers","contributors_url":"https://api.github.com/repos/Coenego/grasshopper-ui/contributors","subscribers_url":"https://api.github.com/repos/Coenego/grasshopper-ui/subscribers","subscription_url":"https://api.github.com/repos/Coenego/grasshopper-ui/subscription","commits_url":"https://api.github.com/repos/Coenego/grasshopper-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/Coenego/grasshopper-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/Coenego/grasshopper-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/Coenego/grasshopper-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/Coenego/grasshopper-ui/contents/{+path}","compare_url":"https://api.github.com/repos/Coenego/grasshopper-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Coenego/grasshopper-ui/merges","archive_url":"https://api.github.com/repos/Coenego/grasshopper-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Coenego/grasshopper-ui/downloads","issues_url":"https://api.github.com/repos/Coenego/grasshopper-ui/issues{/number}","pulls_url":"https://api.github.com/repos/Coenego/grasshopper-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/Coenego/grasshopper-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/Coenego/grasshopper-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Coenego/grasshopper-ui/labels{/name}","releases_url":"https://api.github.com/repos/Coenego/grasshopper-ui/releases{/id}","created_at":"2014-11-06T13:08:06Z","updated_at":"2015-04-02T11:24:47Z","pushed_at":"2015-04-10T14:32:13Z","git_url":"git://github.com/Coenego/grasshopper-ui.git","ssh_url":"git@github.com:Coenego/grasshopper-ui.git","clone_url":"https://github.com/Coenego/grasshopper-ui.git","svn_url":"https://github.com/Coenego/grasshopper-ui","homepage":null,"size":9203,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"CUL-DigitalServices:master","ref":"master","sha":"75ae55d926bba4b2c8e75278242991202dd24cba","user":{"login":"CUL-DigitalServices","id":5594563,"avatar_url":"https://avatars.githubusercontent.com/u/5594563?v=3","gravatar_id":"","url":"https://api.github.com/users/CUL-DigitalServices","html_url":"https://github.com/CUL-DigitalServices","followers_url":"https://api.github.com/users/CUL-DigitalServices/followers","following_url":"https://api.github.com/users/CUL-DigitalServices/following{/other_user}","gists_url":"https://api.github.com/users/CUL-DigitalServices/gists{/gist_id}","starred_url":"https://api.github.com/users/CUL-DigitalServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUL-DigitalServices/subscriptions","organizations_url":"https://api.github.com/users/CUL-DigitalServices/orgs","repos_url":"https://api.github.com/users/CUL-DigitalServices/repos","events_url":"https://api.github.com/users/CUL-DigitalServices/events{/privacy}","received_events_url":"https://api.github.com/users/CUL-DigitalServices/received_events","type":"Organization","site_admin":false},"repo":{"id":26270238,"name":"grasshopper-ui","full_name":"CUL-DigitalServices/grasshopper-ui","owner":{"login":"CUL-DigitalServices","id":5594563,"avatar_url":"https://avatars.githubusercontent.com/u/5594563?v=3","gravatar_id":"","url":"https://api.github.com/users/CUL-DigitalServices","html_url":"https://github.com/CUL-DigitalServices","followers_url":"https://api.github.com/users/CUL-DigitalServices/followers","following_url":"https://api.github.com/users/CUL-DigitalServices/following{/other_user}","gists_url":"https://api.github.com/users/CUL-DigitalServices/gists{/gist_id}","starred_url":"https://api.github.com/users/CUL-DigitalServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUL-DigitalServices/subscriptions","organizations_url":"https://api.github.com/users/CUL-DigitalServices/orgs","repos_url":"https://api.github.com/users/CUL-DigitalServices/repos","events_url":"https://api.github.com/users/CUL-DigitalServices/events{/privacy}","received_events_url":"https://api.github.com/users/CUL-DigitalServices/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CUL-DigitalServices/grasshopper-ui","description":"Grasshopper UI","fork":true,"url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui","forks_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/forks","keys_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/teams","hooks_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/hooks","issue_events_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/events{/number}","events_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/events","assignees_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/assignees{/user}","branches_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/branches{/branch}","tags_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/tags","blobs_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/languages","stargazers_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/stargazers","contributors_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/contributors","subscribers_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/subscribers","subscription_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/subscription","commits_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/contents/{+path}","compare_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/merges","archive_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/downloads","issues_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues{/number}","pulls_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/labels{/name}","releases_url":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/releases{/id}","created_at":"2014-11-06T13:06:00Z","updated_at":"2015-04-10T11:18:06Z","pushed_at":"2015-04-10T14:32:13Z","git_url":"git://github.com/CUL-DigitalServices/grasshopper-ui.git","ssh_url":"git@github.com:CUL-DigitalServices/grasshopper-ui.git","clone_url":"https://github.com/CUL-DigitalServices/grasshopper-ui.git","svn_url":"https://github.com/CUL-DigitalServices/grasshopper-ui","homepage":null,"size":10396,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":20,"forks":3,"open_issues":20,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322"},"html":{"href":"https://github.com/CUL-DigitalServices/grasshopper-ui/pull/322"},"issue":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/322"},"comments":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/CUL-DigitalServices/grasshopper-ui/statuses/05be73c80b5fd665c6cfbb41bfae21f0da227c85"}}}}