{"action":"created","comment":{"url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/comments/40995790","id":40995790,"diff_hunk":"@@ -0,0 +1,319 @@\n+define([\n+    \"angular\",\n+    \"commonApp\",\n+    \"bankingCommonApp\"\n+], function(angular) {\n+\n+    angular.module('fonds', ['banking'])\n+    .controller('fondsController', [\n+        '$scope',\n+        '$controller',\n+        '$log',\n+        '$timeout',\n+        '$filter',\n+        'fondsService',\n+        'linksService',\n+        'questionStorage',\n+        function ($scope, $controller, $log, $timeout, $filter, fondsService, linksService, questionStorage) {\n+\n+            $scope.formTitle = 'Om lånet';\n+            $scope.mobileResultsTitle = 'Beste lån nå';\n+            $scope.noResultsText = 'Vi finner dessverre ingen lån som passer med dine oppgitte beløp. Vennligst endre disse og forsøk på nytt.';\n+\n+            $scope.questions = {\n+                bankToCompareWith: { // required for 'banking' controller, although isn't used in 'fonds' controller.\n+                    bank: null,\n+                    value: null\n+                },\n+                fondToCompareWith: {\n+                    value: null, // contains fond's isin and is linked to select box in UI; will be stored in questions storage\n+                    fond: null, // contains a fond object, which isin is equals to fondToCompareWith.value. Can be null, if selected fond isn't represented in results table.\n+                    returnsRank: null\n+                },\n+                fondType: {\n+                    filterType: 'checkbox',\n+                    title: 'Fondstype',\n+                    helpText: 'Velg fondstype.',\n+                    postValuesAsKeys: true,\n+                    allValues: ['all', '2185', '2431', '2430'],\n+                    allValueTitles: ['Alle', 'Internasjonale pengemarkedsfond', 'Pengemarkedsfond', 'Pengemarkedsfond med lav risiko'],\n+                    value: 'all'\n+                },\n+                returnsFor: {\n+                    filterType: 'radio',\n+                    title: 'Avkastning',\n+                    helpText: 'Tallene viser netto avkastning (endringen i netto andelsverdi) for den tidsperioden som er valgt. Dette betyr at avkastningen er korrigert for forvaltningsgebyrer og andre løpende kostnader som skal belastes fondet , men ikke for tegningsgebyr og innløsingsgebyr (som belastes andelseieren). Tidsperioden kan justeres under ”Filtreringsmuligheter” over. Avkastningstall utover 12 måneder er gjennomsnittlig avkastning per år (geometrisk snitt).',\n+                    postValuesAsKeys: true,\n+                    allValues: ['year1', 'year2', 'year3', 'year5', 'year7', 'year10'],\n+                    allValueTitles: ['Siste år', 'Hittil i år', 'Siste tre år', 'Siste fem år', 'Siste sju år', 'Siste ti år'],\n+                    value: 'year1'\n+                },\n+                riskClass: {\n+                    filterType: 'checkbox',\n+                    title: 'Risikoklasse ',\n+                    helpText: 'Velg risikoklasse, hvor 1 er den laveste risikoen, og 7 er den høyeste risikoen.',\n+                    postValuesAsKeys: true,\n+                    allValues: ['all', '1', '2', '3', '4', '5', '6', '7'],\n+                    allValueTitles: ['Alle', '1 (lav risiko)', '2', '3', '4', '5', '6', '7 (høy risiko)'],\n+                    value: 'all'\n+                }\n+            };\n+\n+            // value used in UI to display currently selected returns period\n+            $scope.selectedReturnsFor = null;\n+\n+            $scope.updateSelectedReturnsFor = function() {\n+                var returnsForValue = $scope.questions.returnsFor.value;\n+                var idx = $scope.questions.returnsFor.allValues.indexOf(returnsForValue);\n+                $scope.selectedReturnsFor = $scope.questions.returnsFor.allValueTitles[idx].toLowerCase();\n+            };\n+\n+            $scope.updateSelectedFond = function() {\n+                if($scope.questions.fondToCompareWith.value === null) {\n+                    $scope.questions.fondToCompareWith.fond = null;\n+                    $scope.questions.fondToCompareWith.returnsRank = null;\n+                } else {\n+                    var fondFound = false;\n+                    for(var i = 0; i < $scope.results.data.length; i++) {\n+                        var fond = $scope.results.data[i];\n+                        if($scope.questions.fondToCompareWith.value === fond.fond.isin) {\n+                            $scope.questions.fondToCompareWith.fond = fond;\n+                            fondFound = true;\n+                            break;\n+                        }\n+                    }\n+                    if(!fondFound) {\n+                        $scope.questions.fondToCompareWith.fond = null;\n+                        $scope.questions.fondToCompareWith.returnsRank = null;\n+                    } else {\n+                        // calculate selected fond 'rank' by returns.\n+                        var dataCopy = $scope.results.data.slice();\n+                        var orderBy = $scope.adjustOrderBy('fond.returns');\n+                        dataCopy = $filter('orderBy')(dataCopy, orderBy, false);\n+                        var rank = 0;\n+                        for(var j = 0; j < dataCopy.length; j++) {\n+                            if($scope.questions.fondToCompareWith.fond.fond.isin === dataCopy[j].fond.isin) {\n+                                rank = j + 1;\n+                                break;\n+                            }\n+                        }\n+                        $scope.questions.fondToCompareWith.returnsRank = rank;\n+                    }\n+                }\n+            };\n+\n+            $scope.getFondReturnsForSelectedPeriod = function(fond) {\n+                var value = fond.returns[$scope.questions.returnsFor.value];\n+                return value === undefined ? '' : $filter('number')(value, 2) + ' %';\n+            };\n+\n+            $scope.storageName = 'fonds';\n+            $scope.bankingServiceImpl = fondsService;\n+\n+            // extend banking controller, which contains a logic for table and filters\n+            angular.extend(this, $controller('banking', {$scope: $scope}));\n+\n+            // don't close search form on mobile after search is triggered\n+            $scope.closeFormMobileOnGetResults = false;\n+\n+            // @override see 'banking' controller; this functionality isn't used\n+            $scope.isCurBankItem = function (resultItem) {","path":"site-cms/wordpress/wp-content/themes/finansportalen/external/js/fond/fond-app.js","position":null,"original_position":120,"commit_id":"353b1031abef8f02c00f22d1d510ff46388c5cac","original_commit_id":"f4fa695a29399b232fa3910ac41a4d2b0ffbd3b9","user":{"login":"ssinica","id":1715930,"avatar_url":"https://avatars.githubusercontent.com/u/1715930?v=3","gravatar_id":"","url":"https://api.github.com/users/ssinica","html_url":"https://github.com/ssinica","followers_url":"https://api.github.com/users/ssinica/followers","following_url":"https://api.github.com/users/ssinica/following{/other_user}","gists_url":"https://api.github.com/users/ssinica/gists{/gist_id}","starred_url":"https://api.github.com/users/ssinica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssinica/subscriptions","organizations_url":"https://api.github.com/users/ssinica/orgs","repos_url":"https://api.github.com/users/ssinica/repos","events_url":"https://api.github.com/users/ssinica/events{/privacy}","received_events_url":"https://api.github.com/users/ssinica/received_events","type":"User","site_admin":false},"body":"removed!","created_at":"2015-10-02T07:09:56Z","updated_at":"2015-10-02T07:09:56Z","html_url":"https://github.com/finansportalen/finansportalen2/pull/10#discussion_r40995790","pull_request_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/comments/40995790"},"html":{"href":"https://github.com/finansportalen/finansportalen2/pull/10#discussion_r40995790"},"pull_request":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10","id":46543591,"html_url":"https://github.com/finansportalen/finansportalen2/pull/10","diff_url":"https://github.com/finansportalen/finansportalen2/pull/10.diff","patch_url":"https://github.com/finansportalen/finansportalen2/pull/10.patch","issue_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/10","number":10,"state":"open","locked":false,"title":"S-2472: Money market funds/Pengemarkedsfond module migration","user":{"login":"ssinica","id":1715930,"avatar_url":"https://avatars.githubusercontent.com/u/1715930?v=3","gravatar_id":"","url":"https://api.github.com/users/ssinica","html_url":"https://github.com/ssinica","followers_url":"https://api.github.com/users/ssinica/followers","following_url":"https://api.github.com/users/ssinica/following{/other_user}","gists_url":"https://api.github.com/users/ssinica/gists{/gist_id}","starred_url":"https://api.github.com/users/ssinica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssinica/subscriptions","organizations_url":"https://api.github.com/users/ssinica/orgs","repos_url":"https://api.github.com/users/ssinica/repos","events_url":"https://api.github.com/users/ssinica/events{/privacy}","received_events_url":"https://api.github.com/users/ssinica/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-01T16:07:22Z","updated_at":"2015-10-02T07:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83e907c59917070ce182e06c17cd279545ad3c6f","assignee":{"login":"tomsfeldmanis","id":4329964,"avatar_url":"https://avatars.githubusercontent.com/u/4329964?v=3","gravatar_id":"","url":"https://api.github.com/users/tomsfeldmanis","html_url":"https://github.com/tomsfeldmanis","followers_url":"https://api.github.com/users/tomsfeldmanis/followers","following_url":"https://api.github.com/users/tomsfeldmanis/following{/other_user}","gists_url":"https://api.github.com/users/tomsfeldmanis/gists{/gist_id}","starred_url":"https://api.github.com/users/tomsfeldmanis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomsfeldmanis/subscriptions","organizations_url":"https://api.github.com/users/tomsfeldmanis/orgs","repos_url":"https://api.github.com/users/tomsfeldmanis/repos","events_url":"https://api.github.com/users/tomsfeldmanis/events{/privacy}","received_events_url":"https://api.github.com/users/tomsfeldmanis/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10/commits","review_comments_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10/comments","review_comment_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/10/comments","statuses_url":"https://api.github.com/repos/finansportalen/finansportalen2/statuses/353b1031abef8f02c00f22d1d510ff46388c5cac","head":{"label":"finansportalen:S-2472-2","ref":"S-2472-2","sha":"353b1031abef8f02c00f22d1d510ff46388c5cac","user":{"login":"finansportalen","id":2227134,"avatar_url":"https://avatars.githubusercontent.com/u/2227134?v=3","gravatar_id":"","url":"https://api.github.com/users/finansportalen","html_url":"https://github.com/finansportalen","followers_url":"https://api.github.com/users/finansportalen/followers","following_url":"https://api.github.com/users/finansportalen/following{/other_user}","gists_url":"https://api.github.com/users/finansportalen/gists{/gist_id}","starred_url":"https://api.github.com/users/finansportalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finansportalen/subscriptions","organizations_url":"https://api.github.com/users/finansportalen/orgs","repos_url":"https://api.github.com/users/finansportalen/repos","events_url":"https://api.github.com/users/finansportalen/events{/privacy}","received_events_url":"https://api.github.com/users/finansportalen/received_events","type":"Organization","site_admin":false},"repo":{"id":39569452,"name":"finansportalen2","full_name":"finansportalen/finansportalen2","owner":{"login":"finansportalen","id":2227134,"avatar_url":"https://avatars.githubusercontent.com/u/2227134?v=3","gravatar_id":"","url":"https://api.github.com/users/finansportalen","html_url":"https://github.com/finansportalen","followers_url":"https://api.github.com/users/finansportalen/followers","following_url":"https://api.github.com/users/finansportalen/following{/other_user}","gists_url":"https://api.github.com/users/finansportalen/gists{/gist_id}","starred_url":"https://api.github.com/users/finansportalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finansportalen/subscriptions","organizations_url":"https://api.github.com/users/finansportalen/orgs","repos_url":"https://api.github.com/users/finansportalen/repos","events_url":"https://api.github.com/users/finansportalen/events{/privacy}","received_events_url":"https://api.github.com/users/finansportalen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/finansportalen/finansportalen2","description":"Finansportalen 2.0 (redesign)","fork":false,"url":"https://api.github.com/repos/finansportalen/finansportalen2","forks_url":"https://api.github.com/repos/finansportalen/finansportalen2/forks","keys_url":"https://api.github.com/repos/finansportalen/finansportalen2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/finansportalen/finansportalen2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/finansportalen/finansportalen2/teams","hooks_url":"https://api.github.com/repos/finansportalen/finansportalen2/hooks","issue_events_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/events{/number}","events_url":"https://api.github.com/repos/finansportalen/finansportalen2/events","assignees_url":"https://api.github.com/repos/finansportalen/finansportalen2/assignees{/user}","branches_url":"https://api.github.com/repos/finansportalen/finansportalen2/branches{/branch}","tags_url":"https://api.github.com/repos/finansportalen/finansportalen2/tags","blobs_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/refs{/sha}","trees_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/finansportalen/finansportalen2/statuses/{sha}","languages_url":"https://api.github.com/repos/finansportalen/finansportalen2/languages","stargazers_url":"https://api.github.com/repos/finansportalen/finansportalen2/stargazers","contributors_url":"https://api.github.com/repos/finansportalen/finansportalen2/contributors","subscribers_url":"https://api.github.com/repos/finansportalen/finansportalen2/subscribers","subscription_url":"https://api.github.com/repos/finansportalen/finansportalen2/subscription","commits_url":"https://api.github.com/repos/finansportalen/finansportalen2/commits{/sha}","git_commits_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/commits{/sha}","comments_url":"https://api.github.com/repos/finansportalen/finansportalen2/comments{/number}","issue_comment_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/comments{/number}","contents_url":"https://api.github.com/repos/finansportalen/finansportalen2/contents/{+path}","compare_url":"https://api.github.com/repos/finansportalen/finansportalen2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/finansportalen/finansportalen2/merges","archive_url":"https://api.github.com/repos/finansportalen/finansportalen2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/finansportalen/finansportalen2/downloads","issues_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues{/number}","pulls_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls{/number}","milestones_url":"https://api.github.com/repos/finansportalen/finansportalen2/milestones{/number}","notifications_url":"https://api.github.com/repos/finansportalen/finansportalen2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/finansportalen/finansportalen2/labels{/name}","releases_url":"https://api.github.com/repos/finansportalen/finansportalen2/releases{/id}","created_at":"2015-07-23T13:38:11Z","updated_at":"2015-07-24T10:30:00Z","pushed_at":"2015-10-02T07:09:30Z","git_url":"git://github.com/finansportalen/finansportalen2.git","ssh_url":"git@github.com:finansportalen/finansportalen2.git","clone_url":"https://github.com/finansportalen/finansportalen2.git","svn_url":"https://github.com/finansportalen/finansportalen2","homepage":null,"size":22204,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"master"}},"base":{"label":"finansportalen:master","ref":"master","sha":"395e09338c9e3e21778add4eb7c931033884fd22","user":{"login":"finansportalen","id":2227134,"avatar_url":"https://avatars.githubusercontent.com/u/2227134?v=3","gravatar_id":"","url":"https://api.github.com/users/finansportalen","html_url":"https://github.com/finansportalen","followers_url":"https://api.github.com/users/finansportalen/followers","following_url":"https://api.github.com/users/finansportalen/following{/other_user}","gists_url":"https://api.github.com/users/finansportalen/gists{/gist_id}","starred_url":"https://api.github.com/users/finansportalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finansportalen/subscriptions","organizations_url":"https://api.github.com/users/finansportalen/orgs","repos_url":"https://api.github.com/users/finansportalen/repos","events_url":"https://api.github.com/users/finansportalen/events{/privacy}","received_events_url":"https://api.github.com/users/finansportalen/received_events","type":"Organization","site_admin":false},"repo":{"id":39569452,"name":"finansportalen2","full_name":"finansportalen/finansportalen2","owner":{"login":"finansportalen","id":2227134,"avatar_url":"https://avatars.githubusercontent.com/u/2227134?v=3","gravatar_id":"","url":"https://api.github.com/users/finansportalen","html_url":"https://github.com/finansportalen","followers_url":"https://api.github.com/users/finansportalen/followers","following_url":"https://api.github.com/users/finansportalen/following{/other_user}","gists_url":"https://api.github.com/users/finansportalen/gists{/gist_id}","starred_url":"https://api.github.com/users/finansportalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finansportalen/subscriptions","organizations_url":"https://api.github.com/users/finansportalen/orgs","repos_url":"https://api.github.com/users/finansportalen/repos","events_url":"https://api.github.com/users/finansportalen/events{/privacy}","received_events_url":"https://api.github.com/users/finansportalen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/finansportalen/finansportalen2","description":"Finansportalen 2.0 (redesign)","fork":false,"url":"https://api.github.com/repos/finansportalen/finansportalen2","forks_url":"https://api.github.com/repos/finansportalen/finansportalen2/forks","keys_url":"https://api.github.com/repos/finansportalen/finansportalen2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/finansportalen/finansportalen2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/finansportalen/finansportalen2/teams","hooks_url":"https://api.github.com/repos/finansportalen/finansportalen2/hooks","issue_events_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/events{/number}","events_url":"https://api.github.com/repos/finansportalen/finansportalen2/events","assignees_url":"https://api.github.com/repos/finansportalen/finansportalen2/assignees{/user}","branches_url":"https://api.github.com/repos/finansportalen/finansportalen2/branches{/branch}","tags_url":"https://api.github.com/repos/finansportalen/finansportalen2/tags","blobs_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/refs{/sha}","trees_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/finansportalen/finansportalen2/statuses/{sha}","languages_url":"https://api.github.com/repos/finansportalen/finansportalen2/languages","stargazers_url":"https://api.github.com/repos/finansportalen/finansportalen2/stargazers","contributors_url":"https://api.github.com/repos/finansportalen/finansportalen2/contributors","subscribers_url":"https://api.github.com/repos/finansportalen/finansportalen2/subscribers","subscription_url":"https://api.github.com/repos/finansportalen/finansportalen2/subscription","commits_url":"https://api.github.com/repos/finansportalen/finansportalen2/commits{/sha}","git_commits_url":"https://api.github.com/repos/finansportalen/finansportalen2/git/commits{/sha}","comments_url":"https://api.github.com/repos/finansportalen/finansportalen2/comments{/number}","issue_comment_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues/comments{/number}","contents_url":"https://api.github.com/repos/finansportalen/finansportalen2/contents/{+path}","compare_url":"https://api.github.com/repos/finansportalen/finansportalen2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/finansportalen/finansportalen2/merges","archive_url":"https://api.github.com/repos/finansportalen/finansportalen2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/finansportalen/finansportalen2/downloads","issues_url":"https://api.github.com/repos/finansportalen/finansportalen2/issues{/number}","pulls_url":"https://api.github.com/repos/finansportalen/finansportalen2/pulls{/number}","milestones_url":"https://api.github.com/repos/finansportalen/finansportalen2/milestones{/number}","notifications_url":"https://api.github.com/repos/finansportalen/finansportalen2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/finansportalen/finansportalen2/labels{/name}","releases_url":"https://api.github.com/repos/finansportalen/finansportalen2/releases{/id}","created_at":"2015-07-23T13:38:11Z","updated_at":"2015-07-24T10:30:00Z","pushed_at":"2015-10-02T07:09:30Z","git_url":"git://github.com/finansportalen/finansportalen2.git","ssh_url":"git@github.com:finansportalen/finansportalen2.git","clone_url":"https://github.com/finansportalen/finansportalen2.git","svn_url":"https://github.com/finansportalen/finansportalen2","homepage":null,"size":22204,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10"},"html":{"href":"https://github.com/finansportalen/finansportalen2/pull/10"},"issue":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/issues/10"},"comments":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/finansportalen/finansportalen2/statuses/353b1031abef8f02c00f22d1d510ff46388c5cac"}}}}