{"action":"created","comment":{"url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/comments/77798898","id":77798898,"diff_hunk":"@@ -412,4 +485,62 @@ private LocalDateTime parseLocalDateTime(String text) {\n     return LocalDateTime.parse(text, formatter);\n   }\n \n+  private class EventComparator implements Comparator<fi.otavanopisto.mikkelinyt.model.Event> {\n+    \n+    private EventOrder order;\n+    private EventOrderDirection direction;\n+    \n+    public EventComparator(EventOrder order, EventOrderDirection direction) {\n+      this.order = order;\n+      this.direction = direction;\n+    }\n+    \n+    @Override\n+    public int compare(fi.otavanopisto.mikkelinyt.model.Event event1, fi.otavanopisto.mikkelinyt.model.Event event2) {\n+      int result;\n+      \n+      switch (order) {\n+        case END_DATE:\n+          result = compareEndDates(event1, event2);\n+        break;\n+        case START_DATE:\n+          result = compareStartDates(event1, event2);\n+        break;\n+        default:\n+          result = 0;\n+        break;\n+      }\n+      \n+      if (direction == EventOrderDirection.ASCENDING) {\n+        return -result;\n+      } \n+      \n+      return result;\n+    }\n+\n+    private int compareStartDates(fi.otavanopisto.mikkelinyt.model.Event event1,\n+        fi.otavanopisto.mikkelinyt.model.Event event2) {\n+      return compareDates(parseLocalDateTime(event1.getStart()), parseLocalDateTime(event2.getStart()));\n+    }\n+\n+    private int compareEndDates(fi.otavanopisto.mikkelinyt.model.Event event1,\n+        fi.otavanopisto.mikkelinyt.model.Event event2) {\n+      return compareDates(parseLocalDateTime(event1.getEnd()), parseLocalDateTime(event2.getEnd()));\n+    }\n+    \n+    private int compareDates(LocalDateTime dateTime1, LocalDateTime dateTime2) {","path":"kunta-api-server/src/main/java/fi/otavanopisto/kuntaapi/server/integrations/mikkelinyt/MikkeliNytEventProvider.java","position":171,"original_position":171,"commit_id":"65e38bed11985ae4eafe6fa9ffe9577d73880cf0","original_commit_id":"65e38bed11985ae4eafe6fa9ffe9577d73880cf0","user":{"login":"sonarq","id":21039853,"avatar_url":"https://avatars.githubusercontent.com/u/21039853?v=3","gravatar_id":"","url":"https://api.github.com/users/sonarq","html_url":"https://github.com/sonarq","followers_url":"https://api.github.com/users/sonarq/followers","following_url":"https://api.github.com/users/sonarq/following{/other_user}","gists_url":"https://api.github.com/users/sonarq/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarq/subscriptions","organizations_url":"https://api.github.com/users/sonarq/orgs","repos_url":"https://api.github.com/users/sonarq/repos","events_url":"https://api.github.com/users/sonarq/events{/privacy}","received_events_url":"https://api.github.com/users/sonarq/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Remove this unused private \"compareDates\" method. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonarqube.com/coding_rules#rule_key=squid%3AUnusedPrivateMethod)\n","created_at":"2016-09-07T10:44:00Z","updated_at":"2016-09-07T10:44:00Z","html_url":"https://github.com/otavanopisto/kunta-api/pull/36#discussion_r77798898","pull_request_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/comments/77798898"},"html":{"href":"https://github.com/otavanopisto/kunta-api/pull/36#discussion_r77798898"},"pull_request":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36","id":84276770,"html_url":"https://github.com/otavanopisto/kunta-api/pull/36","diff_url":"https://github.com/otavanopisto/kunta-api/pull/36.diff","patch_url":"https://github.com/otavanopisto/kunta-api/pull/36.patch","issue_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/36","number":36,"state":"open","locked":false,"title":"Feature #33 event options","user":{"login":"anttileppa","id":1730736,"avatar_url":"https://avatars.githubusercontent.com/u/1730736?v=3","gravatar_id":"","url":"https://api.github.com/users/anttileppa","html_url":"https://github.com/anttileppa","followers_url":"https://api.github.com/users/anttileppa/followers","following_url":"https://api.github.com/users/anttileppa/following{/other_user}","gists_url":"https://api.github.com/users/anttileppa/gists{/gist_id}","starred_url":"https://api.github.com/users/anttileppa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anttileppa/subscriptions","organizations_url":"https://api.github.com/users/anttileppa/orgs","repos_url":"https://api.github.com/users/anttileppa/repos","events_url":"https://api.github.com/users/anttileppa/events{/privacy}","received_events_url":"https://api.github.com/users/anttileppa/received_events","type":"User","site_admin":false},"body":"Resolves #33 ","created_at":"2016-09-07T10:42:04Z","updated_at":"2016-09-07T10:44:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fd2923908b816a79cd1c2e437e046bb130a0545","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36/commits","review_comments_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36/comments","review_comment_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/36/comments","statuses_url":"https://api.github.com/repos/otavanopisto/kunta-api/statuses/65e38bed11985ae4eafe6fa9ffe9577d73880cf0","head":{"label":"otavanopisto:feature-#33-event-options","ref":"feature-#33-event-options","sha":"65e38bed11985ae4eafe6fa9ffe9577d73880cf0","user":{"login":"otavanopisto","id":3909061,"avatar_url":"https://avatars.githubusercontent.com/u/3909061?v=3","gravatar_id":"","url":"https://api.github.com/users/otavanopisto","html_url":"https://github.com/otavanopisto","followers_url":"https://api.github.com/users/otavanopisto/followers","following_url":"https://api.github.com/users/otavanopisto/following{/other_user}","gists_url":"https://api.github.com/users/otavanopisto/gists{/gist_id}","starred_url":"https://api.github.com/users/otavanopisto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otavanopisto/subscriptions","organizations_url":"https://api.github.com/users/otavanopisto/orgs","repos_url":"https://api.github.com/users/otavanopisto/repos","events_url":"https://api.github.com/users/otavanopisto/events{/privacy}","received_events_url":"https://api.github.com/users/otavanopisto/received_events","type":"Organization","site_admin":false},"repo":{"id":64730432,"name":"kunta-api","full_name":"otavanopisto/kunta-api","owner":{"login":"otavanopisto","id":3909061,"avatar_url":"https://avatars.githubusercontent.com/u/3909061?v=3","gravatar_id":"","url":"https://api.github.com/users/otavanopisto","html_url":"https://github.com/otavanopisto","followers_url":"https://api.github.com/users/otavanopisto/followers","following_url":"https://api.github.com/users/otavanopisto/following{/other_user}","gists_url":"https://api.github.com/users/otavanopisto/gists{/gist_id}","starred_url":"https://api.github.com/users/otavanopisto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otavanopisto/subscriptions","organizations_url":"https://api.github.com/users/otavanopisto/orgs","repos_url":"https://api.github.com/users/otavanopisto/repos","events_url":"https://api.github.com/users/otavanopisto/events{/privacy}","received_events_url":"https://api.github.com/users/otavanopisto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/otavanopisto/kunta-api","description":"Kunta API","fork":false,"url":"https://api.github.com/repos/otavanopisto/kunta-api","forks_url":"https://api.github.com/repos/otavanopisto/kunta-api/forks","keys_url":"https://api.github.com/repos/otavanopisto/kunta-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otavanopisto/kunta-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otavanopisto/kunta-api/teams","hooks_url":"https://api.github.com/repos/otavanopisto/kunta-api/hooks","issue_events_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/events{/number}","events_url":"https://api.github.com/repos/otavanopisto/kunta-api/events","assignees_url":"https://api.github.com/repos/otavanopisto/kunta-api/assignees{/user}","branches_url":"https://api.github.com/repos/otavanopisto/kunta-api/branches{/branch}","tags_url":"https://api.github.com/repos/otavanopisto/kunta-api/tags","blobs_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otavanopisto/kunta-api/statuses/{sha}","languages_url":"https://api.github.com/repos/otavanopisto/kunta-api/languages","stargazers_url":"https://api.github.com/repos/otavanopisto/kunta-api/stargazers","contributors_url":"https://api.github.com/repos/otavanopisto/kunta-api/contributors","subscribers_url":"https://api.github.com/repos/otavanopisto/kunta-api/subscribers","subscription_url":"https://api.github.com/repos/otavanopisto/kunta-api/subscription","commits_url":"https://api.github.com/repos/otavanopisto/kunta-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/otavanopisto/kunta-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/otavanopisto/kunta-api/contents/{+path}","compare_url":"https://api.github.com/repos/otavanopisto/kunta-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otavanopisto/kunta-api/merges","archive_url":"https://api.github.com/repos/otavanopisto/kunta-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otavanopisto/kunta-api/downloads","issues_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues{/number}","pulls_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls{/number}","milestones_url":"https://api.github.com/repos/otavanopisto/kunta-api/milestones{/number}","notifications_url":"https://api.github.com/repos/otavanopisto/kunta-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otavanopisto/kunta-api/labels{/name}","releases_url":"https://api.github.com/repos/otavanopisto/kunta-api/releases{/id}","deployments_url":"https://api.github.com/repos/otavanopisto/kunta-api/deployments","created_at":"2016-08-02T06:29:07Z","updated_at":"2016-08-31T08:53:44Z","pushed_at":"2016-09-07T10:42:05Z","git_url":"git://github.com/otavanopisto/kunta-api.git","ssh_url":"git@github.com:otavanopisto/kunta-api.git","clone_url":"https://github.com/otavanopisto/kunta-api.git","svn_url":"https://github.com/otavanopisto/kunta-api","homepage":null,"size":11526,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":1,"default_branch":"develop"}},"base":{"label":"otavanopisto:develop","ref":"develop","sha":"6bc3129a558ba5e44835bfe5a74e3dbea3407420","user":{"login":"otavanopisto","id":3909061,"avatar_url":"https://avatars.githubusercontent.com/u/3909061?v=3","gravatar_id":"","url":"https://api.github.com/users/otavanopisto","html_url":"https://github.com/otavanopisto","followers_url":"https://api.github.com/users/otavanopisto/followers","following_url":"https://api.github.com/users/otavanopisto/following{/other_user}","gists_url":"https://api.github.com/users/otavanopisto/gists{/gist_id}","starred_url":"https://api.github.com/users/otavanopisto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otavanopisto/subscriptions","organizations_url":"https://api.github.com/users/otavanopisto/orgs","repos_url":"https://api.github.com/users/otavanopisto/repos","events_url":"https://api.github.com/users/otavanopisto/events{/privacy}","received_events_url":"https://api.github.com/users/otavanopisto/received_events","type":"Organization","site_admin":false},"repo":{"id":64730432,"name":"kunta-api","full_name":"otavanopisto/kunta-api","owner":{"login":"otavanopisto","id":3909061,"avatar_url":"https://avatars.githubusercontent.com/u/3909061?v=3","gravatar_id":"","url":"https://api.github.com/users/otavanopisto","html_url":"https://github.com/otavanopisto","followers_url":"https://api.github.com/users/otavanopisto/followers","following_url":"https://api.github.com/users/otavanopisto/following{/other_user}","gists_url":"https://api.github.com/users/otavanopisto/gists{/gist_id}","starred_url":"https://api.github.com/users/otavanopisto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otavanopisto/subscriptions","organizations_url":"https://api.github.com/users/otavanopisto/orgs","repos_url":"https://api.github.com/users/otavanopisto/repos","events_url":"https://api.github.com/users/otavanopisto/events{/privacy}","received_events_url":"https://api.github.com/users/otavanopisto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/otavanopisto/kunta-api","description":"Kunta API","fork":false,"url":"https://api.github.com/repos/otavanopisto/kunta-api","forks_url":"https://api.github.com/repos/otavanopisto/kunta-api/forks","keys_url":"https://api.github.com/repos/otavanopisto/kunta-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otavanopisto/kunta-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otavanopisto/kunta-api/teams","hooks_url":"https://api.github.com/repos/otavanopisto/kunta-api/hooks","issue_events_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/events{/number}","events_url":"https://api.github.com/repos/otavanopisto/kunta-api/events","assignees_url":"https://api.github.com/repos/otavanopisto/kunta-api/assignees{/user}","branches_url":"https://api.github.com/repos/otavanopisto/kunta-api/branches{/branch}","tags_url":"https://api.github.com/repos/otavanopisto/kunta-api/tags","blobs_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otavanopisto/kunta-api/statuses/{sha}","languages_url":"https://api.github.com/repos/otavanopisto/kunta-api/languages","stargazers_url":"https://api.github.com/repos/otavanopisto/kunta-api/stargazers","contributors_url":"https://api.github.com/repos/otavanopisto/kunta-api/contributors","subscribers_url":"https://api.github.com/repos/otavanopisto/kunta-api/subscribers","subscription_url":"https://api.github.com/repos/otavanopisto/kunta-api/subscription","commits_url":"https://api.github.com/repos/otavanopisto/kunta-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/otavanopisto/kunta-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/otavanopisto/kunta-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/otavanopisto/kunta-api/contents/{+path}","compare_url":"https://api.github.com/repos/otavanopisto/kunta-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otavanopisto/kunta-api/merges","archive_url":"https://api.github.com/repos/otavanopisto/kunta-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otavanopisto/kunta-api/downloads","issues_url":"https://api.github.com/repos/otavanopisto/kunta-api/issues{/number}","pulls_url":"https://api.github.com/repos/otavanopisto/kunta-api/pulls{/number}","milestones_url":"https://api.github.com/repos/otavanopisto/kunta-api/milestones{/number}","notifications_url":"https://api.github.com/repos/otavanopisto/kunta-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otavanopisto/kunta-api/labels{/name}","releases_url":"https://api.github.com/repos/otavanopisto/kunta-api/releases{/id}","deployments_url":"https://api.github.com/repos/otavanopisto/kunta-api/deployments","created_at":"2016-08-02T06:29:07Z","updated_at":"2016-08-31T08:53:44Z","pushed_at":"2016-09-07T10:42:05Z","git_url":"git://github.com/otavanopisto/kunta-api.git","ssh_url":"git@github.com:otavanopisto/kunta-api.git","clone_url":"https://github.com/otavanopisto/kunta-api.git","svn_url":"https://github.com/otavanopisto/kunta-api","homepage":null,"size":11526,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36"},"html":{"href":"https://github.com/otavanopisto/kunta-api/pull/36"},"issue":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/issues/36"},"comments":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/otavanopisto/kunta-api/statuses/65e38bed11985ae4eafe6fa9ffe9577d73880cf0"}}}}
{"actor":{"display_login":"sonarq"}}