{"action":"created","comment":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/215059243","pull_request_review_id":152244012,"id":215059243,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTA1OTI0Mw==","diff_hunk":"@@ -981,11 +985,34 @@ def process_assignment_form(assignment)\n                 end\n       # now that we know what periods we want to keep, we can create them\n       periods.each do |p|\n-        assignment.submission_rule.periods << Period.new(p)\n+        new_period = assignment.submission_rule.periods.build(p)\n+        new_period.submission_rule = assignment.submission_rule\n+        new_period.save!\n       end\n-\n-    elsif !submission_rule_params.blank? # in this case Rails does what we want, so we'll take the easy route\n-      assignment.submission_rule.update_attributes(submission_rule_params[:submission_rule_attributes])\n+    elsif !submission_rule_params.blank? # TODO: do this in a more Rails way\n+      periods = submission_rule_params[:submission_rule_attributes][:periods_attributes]\n+      begin\n+        periods = periods.to_h\n+      rescue\n+      end\n+      periods = case periods\n+      when Hash\n+        periods.map { |_, p| p }.reject { |p| !p.key?(:hours) }\n+      when Array\n+        periods\n+      else\n+        []\n+      end","path":"app/controllers/assignments_controller.rb","position":45,"original_position":45,"commit_id":"02c11da2c531310a1d5a2babe5931afcf14a4ab6","original_commit_id":"02c11da2c531310a1d5a2babe5931afcf14a4ab6","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Layout/EndAlignment: end at 1005, 6 is not aligned with case at 998, 16.","created_at":"2018-09-04T20:39:39Z","updated_at":"2018-09-04T20:39:40Z","html_url":"https://github.com/MarkUsProject/Markus/pull/3524#discussion_r215059243","pull_request_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/215059243"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/3524#discussion_r215059243"},"pull_request":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524"}}},"pull_request":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524","id":213097154,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMDk3MTU0","html_url":"https://github.com/MarkUsProject/Markus/pull/3524","diff_url":"https://github.com/MarkUsProject/Markus/pull/3524.diff","patch_url":"https://github.com/MarkUsProject/Markus/pull/3524.patch","issue_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/3524","number":3524,"state":"open","locked":false,"title":"submission-rule: Fix form submission for rule periods","user":{"login":"david-yz-liu","id":3333115,"node_id":"MDQ6VXNlcjMzMzMxMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/3333115?v=4","gravatar_id":"","url":"https://api.github.com/users/david-yz-liu","html_url":"https://github.com/david-yz-liu","followers_url":"https://api.github.com/users/david-yz-liu/followers","following_url":"https://api.github.com/users/david-yz-liu/following{/other_user}","gists_url":"https://api.github.com/users/david-yz-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/david-yz-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-yz-liu/subscriptions","organizations_url":"https://api.github.com/users/david-yz-liu/orgs","repos_url":"https://api.github.com/users/david-yz-liu/repos","events_url":"https://api.github.com/users/david-yz-liu/events{/privacy}","received_events_url":"https://api.github.com/users/david-yz-liu/received_events","type":"User","site_admin":false},"body":"@adisandro this part of the code is pretty messy and should be rewritten at a later point.","created_at":"2018-09-04T20:39:33Z","updated_at":"2018-09-04T20:39:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9bd82bc7cef168ff487fc0aa5d1dc3ee2348a5e4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524/commits","review_comments_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524/comments","review_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/3524/comments","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/02c11da2c531310a1d5a2babe5931afcf14a4ab6","head":{"label":"david-yz-liu:fix-submission-rule-periods","ref":"fix-submission-rule-periods","sha":"02c11da2c531310a1d5a2babe5931afcf14a4ab6","user":{"login":"david-yz-liu","id":3333115,"node_id":"MDQ6VXNlcjMzMzMxMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/3333115?v=4","gravatar_id":"","url":"https://api.github.com/users/david-yz-liu","html_url":"https://github.com/david-yz-liu","followers_url":"https://api.github.com/users/david-yz-liu/followers","following_url":"https://api.github.com/users/david-yz-liu/following{/other_user}","gists_url":"https://api.github.com/users/david-yz-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/david-yz-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-yz-liu/subscriptions","organizations_url":"https://api.github.com/users/david-yz-liu/orgs","repos_url":"https://api.github.com/users/david-yz-liu/repos","events_url":"https://api.github.com/users/david-yz-liu/events{/privacy}","received_events_url":"https://api.github.com/users/david-yz-liu/received_events","type":"User","site_admin":false},"repo":{"id":18498345,"node_id":"MDEwOlJlcG9zaXRvcnkxODQ5ODM0NQ==","name":"Markus","full_name":"david-yz-liu/Markus","owner":{"login":"david-yz-liu","id":3333115,"node_id":"MDQ6VXNlcjMzMzMxMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/3333115?v=4","gravatar_id":"","url":"https://api.github.com/users/david-yz-liu","html_url":"https://github.com/david-yz-liu","followers_url":"https://api.github.com/users/david-yz-liu/followers","following_url":"https://api.github.com/users/david-yz-liu/following{/other_user}","gists_url":"https://api.github.com/users/david-yz-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/david-yz-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-yz-liu/subscriptions","organizations_url":"https://api.github.com/users/david-yz-liu/orgs","repos_url":"https://api.github.com/users/david-yz-liu/repos","events_url":"https://api.github.com/users/david-yz-liu/events{/privacy}","received_events_url":"https://api.github.com/users/david-yz-liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/david-yz-liu/Markus","description":"Git repository of MarkUs","fork":true,"url":"https://api.github.com/repos/david-yz-liu/Markus","forks_url":"https://api.github.com/repos/david-yz-liu/Markus/forks","keys_url":"https://api.github.com/repos/david-yz-liu/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/david-yz-liu/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/david-yz-liu/Markus/teams","hooks_url":"https://api.github.com/repos/david-yz-liu/Markus/hooks","issue_events_url":"https://api.github.com/repos/david-yz-liu/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/david-yz-liu/Markus/events","assignees_url":"https://api.github.com/repos/david-yz-liu/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/david-yz-liu/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/david-yz-liu/Markus/tags","blobs_url":"https://api.github.com/repos/david-yz-liu/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/david-yz-liu/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/david-yz-liu/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/david-yz-liu/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/david-yz-liu/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/david-yz-liu/Markus/languages","stargazers_url":"https://api.github.com/repos/david-yz-liu/Markus/stargazers","contributors_url":"https://api.github.com/repos/david-yz-liu/Markus/contributors","subscribers_url":"https://api.github.com/repos/david-yz-liu/Markus/subscribers","subscription_url":"https://api.github.com/repos/david-yz-liu/Markus/subscription","commits_url":"https://api.github.com/repos/david-yz-liu/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/david-yz-liu/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/david-yz-liu/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/david-yz-liu/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/david-yz-liu/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/david-yz-liu/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/david-yz-liu/Markus/merges","archive_url":"https://api.github.com/repos/david-yz-liu/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/david-yz-liu/Markus/downloads","issues_url":"https://api.github.com/repos/david-yz-liu/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/david-yz-liu/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/david-yz-liu/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/david-yz-liu/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/david-yz-liu/Markus/labels{/name}","releases_url":"https://api.github.com/repos/david-yz-liu/Markus/releases{/id}","deployments_url":"https://api.github.com/repos/david-yz-liu/Markus/deployments","created_at":"2014-04-06T20:18:54Z","updated_at":"2014-11-07T03:11:01Z","pushed_at":"2018-09-04T20:36:41Z","git_url":"git://github.com/david-yz-liu/Markus.git","ssh_url":"git@github.com:david-yz-liu/Markus.git","clone_url":"https://github.com/david-yz-liu/Markus.git","svn_url":"https://github.com/david-yz-liu/Markus","homepage":"http://www.markusproject.org","size":115006,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MarkUsProject:1.7.0","ref":"1.7.0","sha":"0ed247c2b2f1f27a9c888f39a6047f40ee2a8f17","user":{"login":"MarkUsProject","id":415874,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNTg3NA==","avatar_url":"https://avatars1.githubusercontent.com/u/415874?v=4","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"repo":{"id":940538,"node_id":"MDEwOlJlcG9zaXRvcnk5NDA1Mzg=","name":"Markus","full_name":"MarkUsProject/Markus","owner":{"login":"MarkUsProject","id":415874,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNTg3NA==","avatar_url":"https://avatars1.githubusercontent.com/u/415874?v=4","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MarkUsProject/Markus","description":"Git repository of MarkUs","fork":false,"url":"https://api.github.com/repos/MarkUsProject/Markus","forks_url":"https://api.github.com/repos/MarkUsProject/Markus/forks","keys_url":"https://api.github.com/repos/MarkUsProject/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarkUsProject/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarkUsProject/Markus/teams","hooks_url":"https://api.github.com/repos/MarkUsProject/Markus/hooks","issue_events_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/MarkUsProject/Markus/events","assignees_url":"https://api.github.com/repos/MarkUsProject/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/MarkUsProject/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/MarkUsProject/Markus/tags","blobs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarkUsProject/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarkUsProject/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/MarkUsProject/Markus/languages","stargazers_url":"https://api.github.com/repos/MarkUsProject/Markus/stargazers","contributors_url":"https://api.github.com/repos/MarkUsProject/Markus/contributors","subscribers_url":"https://api.github.com/repos/MarkUsProject/Markus/subscribers","subscription_url":"https://api.github.com/repos/MarkUsProject/Markus/subscription","commits_url":"https://api.github.com/repos/MarkUsProject/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarkUsProject/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarkUsProject/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/MarkUsProject/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarkUsProject/Markus/merges","archive_url":"https://api.github.com/repos/MarkUsProject/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarkUsProject/Markus/downloads","issues_url":"https://api.github.com/repos/MarkUsProject/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/MarkUsProject/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/MarkUsProject/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarkUsProject/Markus/labels{/name}","releases_url":"https://api.github.com/repos/MarkUsProject/Markus/releases{/id}","deployments_url":"https://api.github.com/repos/MarkUsProject/Markus/deployments","created_at":"2010-09-26T16:18:08Z","updated_at":"2018-09-04T12:45:45Z","pushed_at":"2018-09-04T20:39:34Z","git_url":"git://github.com/MarkUsProject/Markus.git","ssh_url":"git@github.com:MarkUsProject/Markus.git","clone_url":"https://github.com/MarkUsProject/Markus.git","svn_url":"https://github.com/MarkUsProject/Markus","homepage":"http://www.markusproject.org","size":115666,"stargazers_count":174,"watchers_count":174,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"archived":false,"open_issues_count":74,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":192,"open_issues":74,"watchers":174,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/3524"},"issue":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/3524"},"comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/3524/comments"},"review_comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524/comments"},"review_comment":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/3524/commits"},"statuses":{"href":"https://api.github.com/repos/MarkUsProject/Markus/statuses/02c11da2c531310a1d5a2babe5931afcf14a4ab6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}