{"action":"created","comment":{"url":"https://api.github.com/repos/cvut/sirius/pulls/comments/41792142","id":41792142,"diff_hunk":"@@ -1,31 +1,29 @@\n require 'role_playing'\n require 'sirius/time_converter'\n-require 'sirius/semester_calendar'\n \n class PlannedTimetableSlot < RolePlaying::Role\n \n-  def initialize(obj, time_converter, semester_calendar)\n+  def initialize(obj, time_converter)\n     super obj\n     @time_converter = time_converter\n-    @semester_calendar = semester_calendar\n   end\n \n-  def generate_events(faculty_semester)\n+  def generate_events(faculty_semester, semester_period)\n     teaching_time = generate_teaching_time\n-    event_periods = plan_calendar(teaching_time)\n+    event_periods = semester_period.plan(teaching_time)\n     create_events(event_periods, faculty_semester).tap do |events|\n       events.map { |e| e.deleted = !!deleted_at }\n     end\n   end\n \n   def clear_extra_events(planned_events)\n-    all_events = Event.where(timetable_slot_id: id)\n+    all_events = Event.where(timetable_slot_id: id, deleted: false)\n     extra_events = filter_extra_events(all_events, planned_events)\n-    extra_events.each(&:delete)\n+    Event.where(id: extra_events.map(&:id), deleted: false).update(deleted: true, applied_schedule_exception_ids: nil)","path":"app/roles/planned_timetable_slot.rb","position":29,"original_position":29,"commit_id":"e30277b7fd29aefe13c0f8da0d0cc60a7ec9e28e","original_commit_id":"e30277b7fd29aefe13c0f8da0d0cc60a7ec9e28e","user":{"login":"jnv","id":616767,"avatar_url":"https://avatars.githubusercontent.com/u/616767?v=3","gravatar_id":"","url":"https://api.github.com/users/jnv","html_url":"https://github.com/jnv","followers_url":"https://api.github.com/users/jnv/followers","following_url":"https://api.github.com/users/jnv/following{/other_user}","gists_url":"https://api.github.com/users/jnv/gists{/gist_id}","starred_url":"https://api.github.com/users/jnv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnv/subscriptions","organizations_url":"https://api.github.com/users/jnv/orgs","repos_url":"https://api.github.com/users/jnv/repos","events_url":"https://api.github.com/users/jnv/events{/privacy}","received_events_url":"https://api.github.com/users/jnv/received_events","type":"User","site_admin":false},"body":"Perhaps this should be extracted to Event's delete method. ","created_at":"2015-10-12T19:29:50Z","updated_at":"2015-10-12T19:29:50Z","html_url":"https://github.com/cvut/sirius/pull/154#discussion_r41792142","pull_request_url":"https://api.github.com/repos/cvut/sirius/pulls/154","_links":{"self":{"href":"https://api.github.com/repos/cvut/sirius/pulls/comments/41792142"},"html":{"href":"https://github.com/cvut/sirius/pull/154#discussion_r41792142"},"pull_request":{"href":"https://api.github.com/repos/cvut/sirius/pulls/154"}}},"pull_request":{"url":"https://api.github.com/repos/cvut/sirius/pulls/154","id":46674167,"html_url":"https://github.com/cvut/sirius/pull/154","diff_url":"https://github.com/cvut/sirius/pull/154.diff","patch_url":"https://github.com/cvut/sirius/pull/154.patch","issue_url":"https://api.github.com/repos/cvut/sirius/issues/154","number":154,"state":"open","locked":false,"title":"Semester periods planning","user":{"login":"flexik","id":1473583,"avatar_url":"https://avatars.githubusercontent.com/u/1473583?v=3","gravatar_id":"","url":"https://api.github.com/users/flexik","html_url":"https://github.com/flexik","followers_url":"https://api.github.com/users/flexik/followers","following_url":"https://api.github.com/users/flexik/following{/other_user}","gists_url":"https://api.github.com/users/flexik/gists{/gist_id}","starred_url":"https://api.github.com/users/flexik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flexik/subscriptions","organizations_url":"https://api.github.com/users/flexik/orgs","repos_url":"https://api.github.com/users/flexik/repos","events_url":"https://api.github.com/users/flexik/events{/privacy}","received_events_url":"https://api.github.com/users/flexik/received_events","type":"User","site_admin":false},"body":"It implements semester scheduling according to semester period dates and enables first_day_override.","created_at":"2015-10-02T19:43:28Z","updated_at":"2015-10-12T19:29:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1f9239980e3d71aad5130f781282a816092acb7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cvut/sirius/pulls/154/commits","review_comments_url":"https://api.github.com/repos/cvut/sirius/pulls/154/comments","review_comment_url":"https://api.github.com/repos/cvut/sirius/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cvut/sirius/issues/154/comments","statuses_url":"https://api.github.com/repos/cvut/sirius/statuses/e30277b7fd29aefe13c0f8da0d0cc60a7ec9e28e","head":{"label":"cvut:semester-periods-planning","ref":"semester-periods-planning","sha":"e30277b7fd29aefe13c0f8da0d0cc60a7ec9e28e","user":{"login":"cvut","id":2183308,"avatar_url":"https://avatars.githubusercontent.com/u/2183308?v=3","gravatar_id":"","url":"https://api.github.com/users/cvut","html_url":"https://github.com/cvut","followers_url":"https://api.github.com/users/cvut/followers","following_url":"https://api.github.com/users/cvut/following{/other_user}","gists_url":"https://api.github.com/users/cvut/gists{/gist_id}","starred_url":"https://api.github.com/users/cvut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvut/subscriptions","organizations_url":"https://api.github.com/users/cvut/orgs","repos_url":"https://api.github.com/users/cvut/repos","events_url":"https://api.github.com/users/cvut/events{/privacy}","received_events_url":"https://api.github.com/users/cvut/received_events","type":"Organization","site_admin":false},"repo":{"id":17978252,"name":"sirius","full_name":"cvut/sirius","owner":{"login":"cvut","id":2183308,"avatar_url":"https://avatars.githubusercontent.com/u/2183308?v=3","gravatar_id":"","url":"https://api.github.com/users/cvut","html_url":"https://github.com/cvut","followers_url":"https://api.github.com/users/cvut/followers","following_url":"https://api.github.com/users/cvut/following{/other_user}","gists_url":"https://api.github.com/users/cvut/gists{/gist_id}","starred_url":"https://api.github.com/users/cvut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvut/subscriptions","organizations_url":"https://api.github.com/users/cvut/orgs","repos_url":"https://api.github.com/users/cvut/repos","events_url":"https://api.github.com/users/cvut/events{/privacy}","received_events_url":"https://api.github.com/users/cvut/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvut/sirius","description":"Time Management & Stuff","fork":false,"url":"https://api.github.com/repos/cvut/sirius","forks_url":"https://api.github.com/repos/cvut/sirius/forks","keys_url":"https://api.github.com/repos/cvut/sirius/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvut/sirius/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvut/sirius/teams","hooks_url":"https://api.github.com/repos/cvut/sirius/hooks","issue_events_url":"https://api.github.com/repos/cvut/sirius/issues/events{/number}","events_url":"https://api.github.com/repos/cvut/sirius/events","assignees_url":"https://api.github.com/repos/cvut/sirius/assignees{/user}","branches_url":"https://api.github.com/repos/cvut/sirius/branches{/branch}","tags_url":"https://api.github.com/repos/cvut/sirius/tags","blobs_url":"https://api.github.com/repos/cvut/sirius/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvut/sirius/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvut/sirius/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvut/sirius/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvut/sirius/statuses/{sha}","languages_url":"https://api.github.com/repos/cvut/sirius/languages","stargazers_url":"https://api.github.com/repos/cvut/sirius/stargazers","contributors_url":"https://api.github.com/repos/cvut/sirius/contributors","subscribers_url":"https://api.github.com/repos/cvut/sirius/subscribers","subscription_url":"https://api.github.com/repos/cvut/sirius/subscription","commits_url":"https://api.github.com/repos/cvut/sirius/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvut/sirius/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvut/sirius/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvut/sirius/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvut/sirius/contents/{+path}","compare_url":"https://api.github.com/repos/cvut/sirius/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvut/sirius/merges","archive_url":"https://api.github.com/repos/cvut/sirius/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvut/sirius/downloads","issues_url":"https://api.github.com/repos/cvut/sirius/issues{/number}","pulls_url":"https://api.github.com/repos/cvut/sirius/pulls{/number}","milestones_url":"https://api.github.com/repos/cvut/sirius/milestones{/number}","notifications_url":"https://api.github.com/repos/cvut/sirius/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvut/sirius/labels{/name}","releases_url":"https://api.github.com/repos/cvut/sirius/releases{/id}","created_at":"2014-03-21T11:46:15Z","updated_at":"2015-04-17T13:19:36Z","pushed_at":"2015-10-10T17:24:32Z","git_url":"git://github.com/cvut/sirius.git","ssh_url":"git@github.com:cvut/sirius.git","clone_url":"https://github.com/cvut/sirius.git","svn_url":"https://github.com/cvut/sirius","homepage":null,"size":6821,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":35,"forks":3,"open_issues":35,"watchers":11,"default_branch":"master"}},"base":{"label":"cvut:master","ref":"master","sha":"36eb5294bbdad5e5b541fa1f1d6238b5d658bf82","user":{"login":"cvut","id":2183308,"avatar_url":"https://avatars.githubusercontent.com/u/2183308?v=3","gravatar_id":"","url":"https://api.github.com/users/cvut","html_url":"https://github.com/cvut","followers_url":"https://api.github.com/users/cvut/followers","following_url":"https://api.github.com/users/cvut/following{/other_user}","gists_url":"https://api.github.com/users/cvut/gists{/gist_id}","starred_url":"https://api.github.com/users/cvut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvut/subscriptions","organizations_url":"https://api.github.com/users/cvut/orgs","repos_url":"https://api.github.com/users/cvut/repos","events_url":"https://api.github.com/users/cvut/events{/privacy}","received_events_url":"https://api.github.com/users/cvut/received_events","type":"Organization","site_admin":false},"repo":{"id":17978252,"name":"sirius","full_name":"cvut/sirius","owner":{"login":"cvut","id":2183308,"avatar_url":"https://avatars.githubusercontent.com/u/2183308?v=3","gravatar_id":"","url":"https://api.github.com/users/cvut","html_url":"https://github.com/cvut","followers_url":"https://api.github.com/users/cvut/followers","following_url":"https://api.github.com/users/cvut/following{/other_user}","gists_url":"https://api.github.com/users/cvut/gists{/gist_id}","starred_url":"https://api.github.com/users/cvut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvut/subscriptions","organizations_url":"https://api.github.com/users/cvut/orgs","repos_url":"https://api.github.com/users/cvut/repos","events_url":"https://api.github.com/users/cvut/events{/privacy}","received_events_url":"https://api.github.com/users/cvut/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvut/sirius","description":"Time Management & Stuff","fork":false,"url":"https://api.github.com/repos/cvut/sirius","forks_url":"https://api.github.com/repos/cvut/sirius/forks","keys_url":"https://api.github.com/repos/cvut/sirius/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvut/sirius/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvut/sirius/teams","hooks_url":"https://api.github.com/repos/cvut/sirius/hooks","issue_events_url":"https://api.github.com/repos/cvut/sirius/issues/events{/number}","events_url":"https://api.github.com/repos/cvut/sirius/events","assignees_url":"https://api.github.com/repos/cvut/sirius/assignees{/user}","branches_url":"https://api.github.com/repos/cvut/sirius/branches{/branch}","tags_url":"https://api.github.com/repos/cvut/sirius/tags","blobs_url":"https://api.github.com/repos/cvut/sirius/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvut/sirius/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvut/sirius/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvut/sirius/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvut/sirius/statuses/{sha}","languages_url":"https://api.github.com/repos/cvut/sirius/languages","stargazers_url":"https://api.github.com/repos/cvut/sirius/stargazers","contributors_url":"https://api.github.com/repos/cvut/sirius/contributors","subscribers_url":"https://api.github.com/repos/cvut/sirius/subscribers","subscription_url":"https://api.github.com/repos/cvut/sirius/subscription","commits_url":"https://api.github.com/repos/cvut/sirius/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvut/sirius/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvut/sirius/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvut/sirius/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvut/sirius/contents/{+path}","compare_url":"https://api.github.com/repos/cvut/sirius/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvut/sirius/merges","archive_url":"https://api.github.com/repos/cvut/sirius/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvut/sirius/downloads","issues_url":"https://api.github.com/repos/cvut/sirius/issues{/number}","pulls_url":"https://api.github.com/repos/cvut/sirius/pulls{/number}","milestones_url":"https://api.github.com/repos/cvut/sirius/milestones{/number}","notifications_url":"https://api.github.com/repos/cvut/sirius/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvut/sirius/labels{/name}","releases_url":"https://api.github.com/repos/cvut/sirius/releases{/id}","created_at":"2014-03-21T11:46:15Z","updated_at":"2015-04-17T13:19:36Z","pushed_at":"2015-10-10T17:24:32Z","git_url":"git://github.com/cvut/sirius.git","ssh_url":"git@github.com:cvut/sirius.git","clone_url":"https://github.com/cvut/sirius.git","svn_url":"https://github.com/cvut/sirius","homepage":null,"size":6821,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":35,"forks":3,"open_issues":35,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cvut/sirius/pulls/154"},"html":{"href":"https://github.com/cvut/sirius/pull/154"},"issue":{"href":"https://api.github.com/repos/cvut/sirius/issues/154"},"comments":{"href":"https://api.github.com/repos/cvut/sirius/issues/154/comments"},"review_comments":{"href":"https://api.github.com/repos/cvut/sirius/pulls/154/comments"},"review_comment":{"href":"https://api.github.com/repos/cvut/sirius/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cvut/sirius/pulls/154/commits"},"statuses":{"href":"https://api.github.com/repos/cvut/sirius/statuses/e30277b7fd29aefe13c0f8da0d0cc60a7ec9e28e"}}}}