{"action":"created","comment":{"url":"https://api.github.com/repos/ishanthukral/Markus/pulls/comments/28747294","id":28747294,"diff_hunk":"@@ -0,0 +1,90 @@\n+class MarkingSchemesController < ApplicationController\n+  include MarkingSchemesHelper\n+\n+  respond_to :html, :js\n+  \n+  def index\n+    @assignments = Assignment.all\n+    @grade_entry_forms = GradeEntryForm.all\n+  end\n+  \n+  def populate\n+    render json: get_table_json_data\n+  end\n+\n+  def create\n+    ActiveRecord::Base.transaction do\n+      begin\n+        # save marking scheme\n+        marking_scheme = \\\n+          MarkingScheme.new(name: params['marking_scheme']['name'])\n+        marking_scheme.save!\n+\n+        # save marking weights\n+        params['marking_scheme']['marking_weights_attributes'].each \\\n+          do |_key, obj|\n+          is_assignment = (obj['type'] == 'Assignment')\n+          marking_weight = MarkingWeight.new(gradable_item_id: obj['id'], \\\n+            is_assignment: is_assignment, marking_scheme_id: \\\n+            marking_scheme.id, weight: obj['weight'])\n+          marking_weight.save!\n+        end\n+      rescue ActiveRecord::RecordInvalid => invalid\n+        # Rollback\n+      end\n+    end\n+\n+    redirect_to marking_schemes_path()\n+  end\n+\n+  def update\n+    ActiveRecord::Base.transaction do\n+      begin\n+        # save marking scheme\n+        marking_scheme = MarkingScheme.where(id: params['id'])[0]\n+        marking_scheme.name = params['marking_scheme']['name']\n+        marking_scheme.save!\n+\n+        # save marking weights\n+        params['marking_scheme']['marking_weights_attributes'].each \\\n+          do |_key, obj|\n+          is_assignment = (obj['type'] == 'Assignment')\n+          marking_weight = MarkingWeight.where(gradable_item_id: obj['id'], \\\n+            is_assignment: is_assignment, \\\n+            marking_scheme_id: marking_scheme.id)[0]\n+          marking_weight.weight = obj['weight']\n+          marking_weight.save!\n+        end\n+      rescue ActiveRecord::RecordInvalid => invalid\n+        # Rollback\n+      end\n+    end\n+\n+    redirect_to marking_schemes_path()\n+  end\n+  \n+  def new\n+    @marking_scheme    = MarkingScheme.new\n+    @assignments       = Assignment.all\n+    @grade_entry_forms = GradeEntryForm.all\n+\n+    @all_gradable_items = @assignments + @grade_entry_forms\n+    @all_gradable_items.count.times do\n+      @marking_scheme.marking_weights.build\n+    end\n+  end\n+\n+  def edit","path":"app/controllers/marking_schemes_controller.rb","position":77,"original_position":77,"commit_id":"5a32d3cbfc9ae1f4eefc562400fe49c3a1a2cb2f","original_commit_id":"5a32d3cbfc9ae1f4eefc562400fe49c3a1a2cb2f","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Assignment Branch Condition size for edit is too high. [16.16/15]","created_at":"2015-04-21T03:13:45Z","updated_at":"2015-04-21T03:13:45Z","html_url":"https://github.com/ishanthukral/Markus/pull/1#discussion_r28747294","pull_request_url":"https://api.github.com/repos/ishanthukral/Markus/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/ishanthukral/Markus/pulls/comments/28747294"},"html":{"href":"https://github.com/ishanthukral/Markus/pull/1#discussion_r28747294"},"pull_request":{"href":"https://api.github.com/repos/ishanthukral/Markus/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ishanthukral/Markus/pulls/1","id":33719751,"html_url":"https://github.com/ishanthukral/Markus/pull/1","diff_url":"https://github.com/ishanthukral/Markus/pull/1.diff","patch_url":"https://github.com/ishanthukral/Markus/pull/1.patch","issue_url":"https://api.github.com/repos/ishanthukral/Markus/issues/1","number":1,"state":"open","locked":false,"title":"Summaries page","user":{"login":"ishanthukral","id":3012375,"avatar_url":"https://avatars.githubusercontent.com/u/3012375?v=3","gravatar_id":"","url":"https://api.github.com/users/ishanthukral","html_url":"https://github.com/ishanthukral","followers_url":"https://api.github.com/users/ishanthukral/followers","following_url":"https://api.github.com/users/ishanthukral/following{/other_user}","gists_url":"https://api.github.com/users/ishanthukral/gists{/gist_id}","starred_url":"https://api.github.com/users/ishanthukral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishanthukral/subscriptions","organizations_url":"https://api.github.com/users/ishanthukral/orgs","repos_url":"https://api.github.com/users/ishanthukral/repos","events_url":"https://api.github.com/users/ishanthukral/events{/privacy}","received_events_url":"https://api.github.com/users/ishanthukral/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-21T00:38:01Z","updated_at":"2015-04-21T03:13:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71a78612a2f006df9b31a62e0bc8f35a841e7c6a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ishanthukral/Markus/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ishanthukral/Markus/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ishanthukral/Markus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ishanthukral/Markus/issues/1/comments","statuses_url":"https://api.github.com/repos/ishanthukral/Markus/statuses/5a32d3cbfc9ae1f4eefc562400fe49c3a1a2cb2f","head":{"label":"ishanthukral:summaries-page","ref":"summaries-page","sha":"5a32d3cbfc9ae1f4eefc562400fe49c3a1a2cb2f","user":{"login":"ishanthukral","id":3012375,"avatar_url":"https://avatars.githubusercontent.com/u/3012375?v=3","gravatar_id":"","url":"https://api.github.com/users/ishanthukral","html_url":"https://github.com/ishanthukral","followers_url":"https://api.github.com/users/ishanthukral/followers","following_url":"https://api.github.com/users/ishanthukral/following{/other_user}","gists_url":"https://api.github.com/users/ishanthukral/gists{/gist_id}","starred_url":"https://api.github.com/users/ishanthukral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishanthukral/subscriptions","organizations_url":"https://api.github.com/users/ishanthukral/orgs","repos_url":"https://api.github.com/users/ishanthukral/repos","events_url":"https://api.github.com/users/ishanthukral/events{/privacy}","received_events_url":"https://api.github.com/users/ishanthukral/received_events","type":"User","site_admin":false},"repo":{"id":29370546,"name":"Markus","full_name":"ishanthukral/Markus","owner":{"login":"ishanthukral","id":3012375,"avatar_url":"https://avatars.githubusercontent.com/u/3012375?v=3","gravatar_id":"","url":"https://api.github.com/users/ishanthukral","html_url":"https://github.com/ishanthukral","followers_url":"https://api.github.com/users/ishanthukral/followers","following_url":"https://api.github.com/users/ishanthukral/following{/other_user}","gists_url":"https://api.github.com/users/ishanthukral/gists{/gist_id}","starred_url":"https://api.github.com/users/ishanthukral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishanthukral/subscriptions","organizations_url":"https://api.github.com/users/ishanthukral/orgs","repos_url":"https://api.github.com/users/ishanthukral/repos","events_url":"https://api.github.com/users/ishanthukral/events{/privacy}","received_events_url":"https://api.github.com/users/ishanthukral/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ishanthukral/Markus","description":"Git repository of MarkUs","fork":true,"url":"https://api.github.com/repos/ishanthukral/Markus","forks_url":"https://api.github.com/repos/ishanthukral/Markus/forks","keys_url":"https://api.github.com/repos/ishanthukral/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ishanthukral/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ishanthukral/Markus/teams","hooks_url":"https://api.github.com/repos/ishanthukral/Markus/hooks","issue_events_url":"https://api.github.com/repos/ishanthukral/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/ishanthukral/Markus/events","assignees_url":"https://api.github.com/repos/ishanthukral/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/ishanthukral/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/ishanthukral/Markus/tags","blobs_url":"https://api.github.com/repos/ishanthukral/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ishanthukral/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ishanthukral/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ishanthukral/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ishanthukral/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/ishanthukral/Markus/languages","stargazers_url":"https://api.github.com/repos/ishanthukral/Markus/stargazers","contributors_url":"https://api.github.com/repos/ishanthukral/Markus/contributors","subscribers_url":"https://api.github.com/repos/ishanthukral/Markus/subscribers","subscription_url":"https://api.github.com/repos/ishanthukral/Markus/subscription","commits_url":"https://api.github.com/repos/ishanthukral/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ishanthukral/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ishanthukral/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ishanthukral/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ishanthukral/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/ishanthukral/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ishanthukral/Markus/merges","archive_url":"https://api.github.com/repos/ishanthukral/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ishanthukral/Markus/downloads","issues_url":"https://api.github.com/repos/ishanthukral/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/ishanthukral/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/ishanthukral/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/ishanthukral/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ishanthukral/Markus/labels{/name}","releases_url":"https://api.github.com/repos/ishanthukral/Markus/releases{/id}","created_at":"2015-01-16T22:23:16Z","updated_at":"2015-01-28T20:25:45Z","pushed_at":"2015-04-21T03:13:41Z","git_url":"git://github.com/ishanthukral/Markus.git","ssh_url":"git@github.com:ishanthukral/Markus.git","clone_url":"https://github.com/ishanthukral/Markus.git","svn_url":"https://github.com/ishanthukral/Markus","homepage":"http://www.markusproject.org","size":20351,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"ishanthukral:master","ref":"master","sha":"67b8c464393dacc9c16b247782a54d039a456573","user":{"login":"ishanthukral","id":3012375,"avatar_url":"https://avatars.githubusercontent.com/u/3012375?v=3","gravatar_id":"","url":"https://api.github.com/users/ishanthukral","html_url":"https://github.com/ishanthukral","followers_url":"https://api.github.com/users/ishanthukral/followers","following_url":"https://api.github.com/users/ishanthukral/following{/other_user}","gists_url":"https://api.github.com/users/ishanthukral/gists{/gist_id}","starred_url":"https://api.github.com/users/ishanthukral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishanthukral/subscriptions","organizations_url":"https://api.github.com/users/ishanthukral/orgs","repos_url":"https://api.github.com/users/ishanthukral/repos","events_url":"https://api.github.com/users/ishanthukral/events{/privacy}","received_events_url":"https://api.github.com/users/ishanthukral/received_events","type":"User","site_admin":false},"repo":{"id":29370546,"name":"Markus","full_name":"ishanthukral/Markus","owner":{"login":"ishanthukral","id":3012375,"avatar_url":"https://avatars.githubusercontent.com/u/3012375?v=3","gravatar_id":"","url":"https://api.github.com/users/ishanthukral","html_url":"https://github.com/ishanthukral","followers_url":"https://api.github.com/users/ishanthukral/followers","following_url":"https://api.github.com/users/ishanthukral/following{/other_user}","gists_url":"https://api.github.com/users/ishanthukral/gists{/gist_id}","starred_url":"https://api.github.com/users/ishanthukral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishanthukral/subscriptions","organizations_url":"https://api.github.com/users/ishanthukral/orgs","repos_url":"https://api.github.com/users/ishanthukral/repos","events_url":"https://api.github.com/users/ishanthukral/events{/privacy}","received_events_url":"https://api.github.com/users/ishanthukral/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ishanthukral/Markus","description":"Git repository of MarkUs","fork":true,"url":"https://api.github.com/repos/ishanthukral/Markus","forks_url":"https://api.github.com/repos/ishanthukral/Markus/forks","keys_url":"https://api.github.com/repos/ishanthukral/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ishanthukral/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ishanthukral/Markus/teams","hooks_url":"https://api.github.com/repos/ishanthukral/Markus/hooks","issue_events_url":"https://api.github.com/repos/ishanthukral/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/ishanthukral/Markus/events","assignees_url":"https://api.github.com/repos/ishanthukral/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/ishanthukral/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/ishanthukral/Markus/tags","blobs_url":"https://api.github.com/repos/ishanthukral/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ishanthukral/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ishanthukral/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ishanthukral/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ishanthukral/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/ishanthukral/Markus/languages","stargazers_url":"https://api.github.com/repos/ishanthukral/Markus/stargazers","contributors_url":"https://api.github.com/repos/ishanthukral/Markus/contributors","subscribers_url":"https://api.github.com/repos/ishanthukral/Markus/subscribers","subscription_url":"https://api.github.com/repos/ishanthukral/Markus/subscription","commits_url":"https://api.github.com/repos/ishanthukral/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ishanthukral/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ishanthukral/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ishanthukral/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ishanthukral/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/ishanthukral/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ishanthukral/Markus/merges","archive_url":"https://api.github.com/repos/ishanthukral/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ishanthukral/Markus/downloads","issues_url":"https://api.github.com/repos/ishanthukral/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/ishanthukral/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/ishanthukral/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/ishanthukral/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ishanthukral/Markus/labels{/name}","releases_url":"https://api.github.com/repos/ishanthukral/Markus/releases{/id}","created_at":"2015-01-16T22:23:16Z","updated_at":"2015-01-28T20:25:45Z","pushed_at":"2015-04-21T03:13:41Z","git_url":"git://github.com/ishanthukral/Markus.git","ssh_url":"git@github.com:ishanthukral/Markus.git","clone_url":"https://github.com/ishanthukral/Markus.git","svn_url":"https://github.com/ishanthukral/Markus","homepage":"http://www.markusproject.org","size":20351,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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/ishanthukral/Markus/pulls/1"},"html":{"href":"https://github.com/ishanthukral/Markus/pull/1"},"issue":{"href":"https://api.github.com/repos/ishanthukral/Markus/issues/1"},"comments":{"href":"https://api.github.com/repos/ishanthukral/Markus/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ishanthukral/Markus/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ishanthukral/Markus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ishanthukral/Markus/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ishanthukral/Markus/statuses/5a32d3cbfc9ae1f4eefc562400fe49c3a1a2cb2f"}}}}