{"action":"created","comment":{"url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/comments/256415335","pull_request_review_id":203220014,"id":256415335,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI1NjQxNTMzNQ==","diff_hunk":"@@ -0,0 +1,47 @@\n+package org.stepik.android.domain.course_calendar.interactor\n+\n+import io.reactivex.Completable\n+import io.reactivex.Observable\n+import io.reactivex.Single\n+import org.stepic.droid.model.CalendarItem\n+import org.stepik.android.domain.calendar.model.CalendarEventData\n+import org.stepik.android.domain.calendar.repository.CalendarRepository\n+import org.stepik.android.domain.course_calendar.model.SectionDateEvent\n+import org.stepik.android.domain.course_calendar.repository.CourseCalendarRepository\n+import org.stepik.android.view.course_content.model.CourseContentItem\n+import javax.inject.Inject\n+\n+class CourseCalendarInteractor\n+@Inject\n+constructor(\n+    private val calendarRepository: CalendarRepository,\n+    private val courseCalendarRepository: CourseCalendarRepository\n+) {\n+    fun getCalendarItems(): Single<List<CalendarItem>> =\n+            calendarRepository.getCalendarItems()\n+\n+    fun syncDeadlinesWithCalendar(event: CalendarEventData, calendarItem: CalendarItem): Observable<Long> {\n+        return calendarRepository.syncCalendarEventData(event, calendarItem)\n+    }\n+\n+    fun applyDatesToCalendar(dates: List<CourseContentItem>, calendarItem: CalendarItem): Completable =\n+        Completable.complete()","path":"app/src/main/java/org/stepik/android/domain/course_calendar/interactor/CourseCalendarInteractor.kt","position":28,"original_position":28,"commit_id":"8a773a25f0c4ad43be6c327aa578ec959d7b59f1","original_commit_id":"8a773a25f0c4ad43be6c327aa578ec959d7b59f1","user":{"login":"eadm","id":3856523,"node_id":"MDQ6VXNlcjM4NTY1MjM=","avatar_url":"https://avatars2.githubusercontent.com/u/3856523?v=4","gravatar_id":"","url":"https://api.github.com/users/eadm","html_url":"https://github.com/eadm","followers_url":"https://api.github.com/users/eadm/followers","following_url":"https://api.github.com/users/eadm/following{/other_user}","gists_url":"https://api.github.com/users/eadm/gists{/gist_id}","starred_url":"https://api.github.com/users/eadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eadm/subscriptions","organizations_url":"https://api.github.com/users/eadm/orgs","repos_url":"https://api.github.com/users/eadm/repos","events_url":"https://api.github.com/users/eadm/events{/privacy}","received_events_url":"https://api.github.com/users/eadm/received_events","type":"User","site_admin":false},"body":"There can be something like this (dirty draft):\r\n```kt\r\nfun applyDatesToCalendar(dates: List<CourseContentItem>, calendarItem: CalendarItem): Completable =\r\n    dates\r\n        .filterIsInstance<CourseContentItem.SectionItem>()\r\n        .flatMap { sectionItem ->\r\n            sectionItem.dates.map { date ->\r\n                sectionItem.section.id to CalendarEventData(title = sectionItem.section.title + context.getString(date.titleRes), deadLine = date.date)\r\n            }\r\n        }\r\n        .toObservable()\r\n        .flatMap { (sectionId, eventData) ->\r\n            calendarRepository\r\n                .syncCalendarEventData(eventData, calendarItem)\r\n                .map { eventId ->\r\n                    SectionDateEvent(eventId, sectionId)\r\n                }\r\n        }\r\n        .toList()\r\n        .doCompletableOnSuccess(courseCalendarRepository::saveSectionDateEvents)\r\n        .ignoreElement()\r\n```","created_at":"2019-02-13T14:21:20Z","updated_at":"2019-02-13T14:22:05Z","html_url":"https://github.com/StepicOrg/stepik-android/pull/314#discussion_r256415335","pull_request_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/comments/256415335"},"html":{"href":"https://github.com/StepicOrg/stepik-android/pull/314#discussion_r256415335"},"pull_request":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314"}}},"pull_request":{"url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314","id":252641374,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUyNjQxMzc0","html_url":"https://github.com/StepicOrg/stepik-android/pull/314","diff_url":"https://github.com/StepicOrg/stepik-android/pull/314.diff","patch_url":"https://github.com/StepicOrg/stepik-android/pull/314.patch","issue_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/314","number":314,"state":"open","locked":false,"title":"[WIP] Feature/deadline sync with default calendar","user":{"login":"rostikjoystick","id":10948054,"node_id":"MDQ6VXNlcjEwOTQ4MDU0","avatar_url":"https://avatars3.githubusercontent.com/u/10948054?v=4","gravatar_id":"","url":"https://api.github.com/users/rostikjoystick","html_url":"https://github.com/rostikjoystick","followers_url":"https://api.github.com/users/rostikjoystick/followers","following_url":"https://api.github.com/users/rostikjoystick/following{/other_user}","gists_url":"https://api.github.com/users/rostikjoystick/gists{/gist_id}","starred_url":"https://api.github.com/users/rostikjoystick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostikjoystick/subscriptions","organizations_url":"https://api.github.com/users/rostikjoystick/orgs","repos_url":"https://api.github.com/users/rostikjoystick/repos","events_url":"https://api.github.com/users/rostikjoystick/events{/privacy}","received_events_url":"https://api.github.com/users/rostikjoystick/received_events","type":"User","site_admin":false},"body":"**YouTrack task**: [#APPS-2181](https://vyahhi.myjetbrains.com/youtrack/issue/APPS-2181)\r\n\r\n**Description List**:\r\n* Synchronize deadlines with system calendar\r\n\r\n","created_at":"2019-02-13T10:37:42Z","updated_at":"2019-02-13T14:22:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"254d3211a75eec5c9900dd88ab33a7e12e46d6e8","assignee":{"login":"rostikjoystick","id":10948054,"node_id":"MDQ6VXNlcjEwOTQ4MDU0","avatar_url":"https://avatars3.githubusercontent.com/u/10948054?v=4","gravatar_id":"","url":"https://api.github.com/users/rostikjoystick","html_url":"https://github.com/rostikjoystick","followers_url":"https://api.github.com/users/rostikjoystick/followers","following_url":"https://api.github.com/users/rostikjoystick/following{/other_user}","gists_url":"https://api.github.com/users/rostikjoystick/gists{/gist_id}","starred_url":"https://api.github.com/users/rostikjoystick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostikjoystick/subscriptions","organizations_url":"https://api.github.com/users/rostikjoystick/orgs","repos_url":"https://api.github.com/users/rostikjoystick/repos","events_url":"https://api.github.com/users/rostikjoystick/events{/privacy}","received_events_url":"https://api.github.com/users/rostikjoystick/received_events","type":"User","site_admin":false},"assignees":[{"login":"rostikjoystick","id":10948054,"node_id":"MDQ6VXNlcjEwOTQ4MDU0","avatar_url":"https://avatars3.githubusercontent.com/u/10948054?v=4","gravatar_id":"","url":"https://api.github.com/users/rostikjoystick","html_url":"https://github.com/rostikjoystick","followers_url":"https://api.github.com/users/rostikjoystick/followers","following_url":"https://api.github.com/users/rostikjoystick/following{/other_user}","gists_url":"https://api.github.com/users/rostikjoystick/gists{/gist_id}","starred_url":"https://api.github.com/users/rostikjoystick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostikjoystick/subscriptions","organizations_url":"https://api.github.com/users/rostikjoystick/orgs","repos_url":"https://api.github.com/users/rostikjoystick/repos","events_url":"https://api.github.com/users/rostikjoystick/events{/privacy}","received_events_url":"https://api.github.com/users/rostikjoystick/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314/commits","review_comments_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314/comments","review_comment_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/314/comments","statuses_url":"https://api.github.com/repos/StepicOrg/stepik-android/statuses/8a773a25f0c4ad43be6c327aa578ec959d7b59f1","head":{"label":"StepicOrg:feature/deadline_sync_with_default_calendar","ref":"feature/deadline_sync_with_default_calendar","sha":"8a773a25f0c4ad43be6c327aa578ec959d7b59f1","user":{"login":"StepicOrg","id":6727350,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MjczNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6727350?v=4","gravatar_id":"","url":"https://api.github.com/users/StepicOrg","html_url":"https://github.com/StepicOrg","followers_url":"https://api.github.com/users/StepicOrg/followers","following_url":"https://api.github.com/users/StepicOrg/following{/other_user}","gists_url":"https://api.github.com/users/StepicOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/StepicOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StepicOrg/subscriptions","organizations_url":"https://api.github.com/users/StepicOrg/orgs","repos_url":"https://api.github.com/users/StepicOrg/repos","events_url":"https://api.github.com/users/StepicOrg/events{/privacy}","received_events_url":"https://api.github.com/users/StepicOrg/received_events","type":"Organization","site_admin":false},"repo":{"id":42045161,"node_id":"MDEwOlJlcG9zaXRvcnk0MjA0NTE2MQ==","name":"stepik-android","full_name":"StepicOrg/stepik-android","private":false,"owner":{"login":"StepicOrg","id":6727350,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MjczNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6727350?v=4","gravatar_id":"","url":"https://api.github.com/users/StepicOrg","html_url":"https://github.com/StepicOrg","followers_url":"https://api.github.com/users/StepicOrg/followers","following_url":"https://api.github.com/users/StepicOrg/following{/other_user}","gists_url":"https://api.github.com/users/StepicOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/StepicOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StepicOrg/subscriptions","organizations_url":"https://api.github.com/users/StepicOrg/orgs","repos_url":"https://api.github.com/users/StepicOrg/repos","events_url":"https://api.github.com/users/StepicOrg/events{/privacy}","received_events_url":"https://api.github.com/users/StepicOrg/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/StepicOrg/stepik-android","description":"Android Application for Taking Open Courses on the Stepik Platform","fork":false,"url":"https://api.github.com/repos/StepicOrg/stepik-android","forks_url":"https://api.github.com/repos/StepicOrg/stepik-android/forks","keys_url":"https://api.github.com/repos/StepicOrg/stepik-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StepicOrg/stepik-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StepicOrg/stepik-android/teams","hooks_url":"https://api.github.com/repos/StepicOrg/stepik-android/hooks","issue_events_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/events{/number}","events_url":"https://api.github.com/repos/StepicOrg/stepik-android/events","assignees_url":"https://api.github.com/repos/StepicOrg/stepik-android/assignees{/user}","branches_url":"https://api.github.com/repos/StepicOrg/stepik-android/branches{/branch}","tags_url":"https://api.github.com/repos/StepicOrg/stepik-android/tags","blobs_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StepicOrg/stepik-android/statuses/{sha}","languages_url":"https://api.github.com/repos/StepicOrg/stepik-android/languages","stargazers_url":"https://api.github.com/repos/StepicOrg/stepik-android/stargazers","contributors_url":"https://api.github.com/repos/StepicOrg/stepik-android/contributors","subscribers_url":"https://api.github.com/repos/StepicOrg/stepik-android/subscribers","subscription_url":"https://api.github.com/repos/StepicOrg/stepik-android/subscription","commits_url":"https://api.github.com/repos/StepicOrg/stepik-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/StepicOrg/stepik-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/StepicOrg/stepik-android/contents/{+path}","compare_url":"https://api.github.com/repos/StepicOrg/stepik-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StepicOrg/stepik-android/merges","archive_url":"https://api.github.com/repos/StepicOrg/stepik-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StepicOrg/stepik-android/downloads","issues_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues{/number}","pulls_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls{/number}","milestones_url":"https://api.github.com/repos/StepicOrg/stepik-android/milestones{/number}","notifications_url":"https://api.github.com/repos/StepicOrg/stepik-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StepicOrg/stepik-android/labels{/name}","releases_url":"https://api.github.com/repos/StepicOrg/stepik-android/releases{/id}","deployments_url":"https://api.github.com/repos/StepicOrg/stepik-android/deployments","created_at":"2015-09-07T09:53:05Z","updated_at":"2019-02-05T20:16:42Z","pushed_at":"2019-02-13T13:09:19Z","git_url":"git://github.com/StepicOrg/stepik-android.git","ssh_url":"git@github.com:StepicOrg/stepik-android.git","clone_url":"https://github.com/StepicOrg/stepik-android.git","svn_url":"https://github.com/StepicOrg/stepik-android","homepage":"https://stepik.org/","size":59608,"stargazers_count":117,"watchers_count":117,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":38,"open_issues":4,"watchers":117,"default_branch":"master"}},"base":{"label":"StepicOrg:master","ref":"master","sha":"66f73d7720df4e6f7c961cd90993af7aa07553d0","user":{"login":"StepicOrg","id":6727350,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MjczNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6727350?v=4","gravatar_id":"","url":"https://api.github.com/users/StepicOrg","html_url":"https://github.com/StepicOrg","followers_url":"https://api.github.com/users/StepicOrg/followers","following_url":"https://api.github.com/users/StepicOrg/following{/other_user}","gists_url":"https://api.github.com/users/StepicOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/StepicOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StepicOrg/subscriptions","organizations_url":"https://api.github.com/users/StepicOrg/orgs","repos_url":"https://api.github.com/users/StepicOrg/repos","events_url":"https://api.github.com/users/StepicOrg/events{/privacy}","received_events_url":"https://api.github.com/users/StepicOrg/received_events","type":"Organization","site_admin":false},"repo":{"id":42045161,"node_id":"MDEwOlJlcG9zaXRvcnk0MjA0NTE2MQ==","name":"stepik-android","full_name":"StepicOrg/stepik-android","private":false,"owner":{"login":"StepicOrg","id":6727350,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MjczNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6727350?v=4","gravatar_id":"","url":"https://api.github.com/users/StepicOrg","html_url":"https://github.com/StepicOrg","followers_url":"https://api.github.com/users/StepicOrg/followers","following_url":"https://api.github.com/users/StepicOrg/following{/other_user}","gists_url":"https://api.github.com/users/StepicOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/StepicOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StepicOrg/subscriptions","organizations_url":"https://api.github.com/users/StepicOrg/orgs","repos_url":"https://api.github.com/users/StepicOrg/repos","events_url":"https://api.github.com/users/StepicOrg/events{/privacy}","received_events_url":"https://api.github.com/users/StepicOrg/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/StepicOrg/stepik-android","description":"Android Application for Taking Open Courses on the Stepik Platform","fork":false,"url":"https://api.github.com/repos/StepicOrg/stepik-android","forks_url":"https://api.github.com/repos/StepicOrg/stepik-android/forks","keys_url":"https://api.github.com/repos/StepicOrg/stepik-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StepicOrg/stepik-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StepicOrg/stepik-android/teams","hooks_url":"https://api.github.com/repos/StepicOrg/stepik-android/hooks","issue_events_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/events{/number}","events_url":"https://api.github.com/repos/StepicOrg/stepik-android/events","assignees_url":"https://api.github.com/repos/StepicOrg/stepik-android/assignees{/user}","branches_url":"https://api.github.com/repos/StepicOrg/stepik-android/branches{/branch}","tags_url":"https://api.github.com/repos/StepicOrg/stepik-android/tags","blobs_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StepicOrg/stepik-android/statuses/{sha}","languages_url":"https://api.github.com/repos/StepicOrg/stepik-android/languages","stargazers_url":"https://api.github.com/repos/StepicOrg/stepik-android/stargazers","contributors_url":"https://api.github.com/repos/StepicOrg/stepik-android/contributors","subscribers_url":"https://api.github.com/repos/StepicOrg/stepik-android/subscribers","subscription_url":"https://api.github.com/repos/StepicOrg/stepik-android/subscription","commits_url":"https://api.github.com/repos/StepicOrg/stepik-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/StepicOrg/stepik-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/StepicOrg/stepik-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/StepicOrg/stepik-android/contents/{+path}","compare_url":"https://api.github.com/repos/StepicOrg/stepik-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StepicOrg/stepik-android/merges","archive_url":"https://api.github.com/repos/StepicOrg/stepik-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StepicOrg/stepik-android/downloads","issues_url":"https://api.github.com/repos/StepicOrg/stepik-android/issues{/number}","pulls_url":"https://api.github.com/repos/StepicOrg/stepik-android/pulls{/number}","milestones_url":"https://api.github.com/repos/StepicOrg/stepik-android/milestones{/number}","notifications_url":"https://api.github.com/repos/StepicOrg/stepik-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StepicOrg/stepik-android/labels{/name}","releases_url":"https://api.github.com/repos/StepicOrg/stepik-android/releases{/id}","deployments_url":"https://api.github.com/repos/StepicOrg/stepik-android/deployments","created_at":"2015-09-07T09:53:05Z","updated_at":"2019-02-05T20:16:42Z","pushed_at":"2019-02-13T13:09:19Z","git_url":"git://github.com/StepicOrg/stepik-android.git","ssh_url":"git@github.com:StepicOrg/stepik-android.git","clone_url":"https://github.com/StepicOrg/stepik-android.git","svn_url":"https://github.com/StepicOrg/stepik-android","homepage":"https://stepik.org/","size":59608,"stargazers_count":117,"watchers_count":117,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":38,"open_issues":4,"watchers":117,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314"},"html":{"href":"https://github.com/StepicOrg/stepik-android/pull/314"},"issue":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/issues/314"},"comments":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/issues/314/comments"},"review_comments":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314/comments"},"review_comment":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/pulls/314/commits"},"statuses":{"href":"https://api.github.com/repos/StepicOrg/stepik-android/statuses/8a773a25f0c4ad43be6c327aa578ec959d7b59f1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"eadm"}}