{"action":"created","comment":{"url":"https://api.github.com/repos/coolcrowd/object-service/pulls/comments/52185881","id":52185881,"diff_hunk":"@@ -231,82 +243,71 @@ private int getAnswerCount(int workerID) {\n      * @param answerRecord whose quality-assured-bit is set\n      */\n     public void setAnswerQualityAssured(AnswerRecord answerRecord) {\n-        //TODO\n+        answerRecord.setQualityAssured(true);\n+\n+        create.batchUpdate(answerRecord).execute();\n     }\n \n     /**\n      * inserts a new rating into the DB\n      *\n      * @param rating       the rating to insert\n-     * @param answerId     the id of the answer which is rated\n-     * @param experimentId the id of the experiment which the rating belongs to\n      *\n      * @return the resulting rating\n      *\n      * @throws IllegalArgumentException if the experiment the rating is referring to is not\n      *                                  existing\n      * @throws IllegalStateException    if the worker is not allowed to submit more ratings\n-     * @\n      */\n-    public Rating insertNewRating(Rating rating, int answerId, int experimentId) throws IllegalArgumentException, IllegalStateException {\n-        RatingRecord ratingRecord = AnswerRatingTransformer.toRatingRecord(rating, answerId, experimentId);\n-        ratingRecord.setIdRating(null);\n+    public Rating insertNewRating(Rating rating) throws IllegalArgumentException, IllegalStateException {\n+        assertHasField(rating, Rating.RATING_FIELD_NUMBER, Rating.RATING_ID_FIELD_NUMBER);\n \n-        ExperimentRecord experiment = experimentOperations.getExperiment(ratingRecord.getExperiment())\n-                .orElseThrow(() -> new IllegalArgumentException(\"Illegal experiment-value in rating record.\"));\n+        boolean isReserved = create.fetchExists(\n+                DSL.selectFrom(RATING)\n+                        .where(RATING.ID_RATING.eq(rating.getRatingId()))\n+                        .and(RATING.WORKER_ID.eq(rating.getWorker()))\n+        );\n \n-        if (getRatingCount(ratingRecord.getWorkerId()) >= experiment.getRatingsPerWorker()) {\n-            throw new IllegalStateException(\n-                    String.format(\"Worker %d already submitted the maximum of allowed ratings\", ratingRecord.getWorkerId())\n-            );\n+        if (!isReserved) {\n+            throw new IllegalStateException(String.format(\"Rating %d is not reserved for worker %d\", rating.getRatingId(), rating.getWorker()));\n+        }\n+\n+        String feedback = null;\n+\n+        if (rating.hasField(rating.getDescriptorForType().findFieldByNumber(Rating.FEEDBACK_FIELD_NUMBER))) {\n+            feedback = rating.getFeedback();\n         }\n \n-        RatingRecord result = doIfRunning(ratingRecord.getExperiment(), conf -> {\n-            RatingRecord record = DSL.using(conf)\n-                    .insertInto(RATING)\n-                    .set(ratingRecord)\n-                    .returning()\n-                    .fetchOne();\n+        create.update(RATING)\n+                .set(RATING.RATING_, rating.getRating())\n+                .set(RATING.FEEDBACK, feedback)\n+                .where(RATING.ID_RATING.eq(rating.getRatingId()))\n+                .execute();","path":"src/main/java/edu/kit/ipd/crowdcontrol/objectservice/database/operations/AnswerRatingOperations.java","position":52,"original_position":136,"commit_id":"2720e446d64fa3d204fdab8878a5739db5b61a97","original_commit_id":"06bdd7cea2eb29609b0af98cd072d38fce47035e","user":{"login":"kelunik","id":2743004,"avatar_url":"https://avatars.githubusercontent.com/u/2743004?v=3","gravatar_id":"","url":"https://api.github.com/users/kelunik","html_url":"https://github.com/kelunik","followers_url":"https://api.github.com/users/kelunik/followers","following_url":"https://api.github.com/users/kelunik/following{/other_user}","gists_url":"https://api.github.com/users/kelunik/gists{/gist_id}","starred_url":"https://api.github.com/users/kelunik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelunik/subscriptions","organizations_url":"https://api.github.com/users/kelunik/orgs","repos_url":"https://api.github.com/users/kelunik/repos","events_url":"https://api.github.com/users/kelunik/events{/privacy}","received_events_url":"https://api.github.com/users/kelunik/received_events","type":"User","site_admin":false},"body":"WIP on `t - 1 day´, great! :wink:","created_at":"2016-02-08T15:55:05Z","updated_at":"2016-02-08T15:55:05Z","html_url":"https://github.com/coolcrowd/object-service/pull/108#discussion_r52185881","pull_request_url":"https://api.github.com/repos/coolcrowd/object-service/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/comments/52185881"},"html":{"href":"https://github.com/coolcrowd/object-service/pull/108#discussion_r52185881"},"pull_request":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/coolcrowd/object-service/pulls/108","id":58533249,"html_url":"https://github.com/coolcrowd/object-service/pull/108","diff_url":"https://github.com/coolcrowd/object-service/pull/108.diff","patch_url":"https://github.com/coolcrowd/object-service/pull/108.patch","issue_url":"https://api.github.com/repos/coolcrowd/object-service/issues/108","number":108,"state":"closed","locked":false,"title":"Fixes - WIP","user":{"login":"LeanderK","id":2179853,"avatar_url":"https://avatars.githubusercontent.com/u/2179853?v=3","gravatar_id":"","url":"https://api.github.com/users/LeanderK","html_url":"https://github.com/LeanderK","followers_url":"https://api.github.com/users/LeanderK/followers","following_url":"https://api.github.com/users/LeanderK/following{/other_user}","gists_url":"https://api.github.com/users/LeanderK/gists{/gist_id}","starred_url":"https://api.github.com/users/LeanderK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeanderK/subscriptions","organizations_url":"https://api.github.com/users/LeanderK/orgs","repos_url":"https://api.github.com/users/LeanderK/repos","events_url":"https://api.github.com/users/LeanderK/events{/privacy}","received_events_url":"https://api.github.com/users/LeanderK/received_events","type":"User","site_admin":false},"body":"* insert Rating was just plain wrong. I don't know what happened there. The problem is for the real solution i needed a parameter which was not provided, so i had to update the proto-files\r\n* various bug fixes\r\n\r\nThe worker-service is tested against this branch, so everybody who wants to run the worker-service must use the object service in this branch.\r\n\r\nI also forgot to switch to master, so the quality branch is in there.\r\n\r\nThis is not ready to merge, but important, so i have already opened the pull-request.","created_at":"2016-02-06T23:16:38Z","updated_at":"2016-02-08T15:55:05Z","closed_at":"2016-02-08T14:02:28Z","merged_at":"2016-02-08T14:02:28Z","merge_commit_sha":"b0c54b1d15b457be0da14daa3a54351fd5ceeccb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coolcrowd/object-service/pulls/108/commits","review_comments_url":"https://api.github.com/repos/coolcrowd/object-service/pulls/108/comments","review_comment_url":"https://api.github.com/repos/coolcrowd/object-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coolcrowd/object-service/issues/108/comments","statuses_url":"https://api.github.com/repos/coolcrowd/object-service/statuses/2720e446d64fa3d204fdab8878a5739db5b61a97","head":{"label":"coolcrowd:fixes","ref":"fixes","sha":"2720e446d64fa3d204fdab8878a5739db5b61a97","user":{"login":"coolcrowd","id":15893550,"avatar_url":"https://avatars.githubusercontent.com/u/15893550?v=3","gravatar_id":"","url":"https://api.github.com/users/coolcrowd","html_url":"https://github.com/coolcrowd","followers_url":"https://api.github.com/users/coolcrowd/followers","following_url":"https://api.github.com/users/coolcrowd/following{/other_user}","gists_url":"https://api.github.com/users/coolcrowd/gists{/gist_id}","starred_url":"https://api.github.com/users/coolcrowd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolcrowd/subscriptions","organizations_url":"https://api.github.com/users/coolcrowd/orgs","repos_url":"https://api.github.com/users/coolcrowd/repos","events_url":"https://api.github.com/users/coolcrowd/events{/privacy}","received_events_url":"https://api.github.com/users/coolcrowd/received_events","type":"Organization","site_admin":false},"repo":{"id":46509189,"name":"object-service","full_name":"coolcrowd/object-service","owner":{"login":"coolcrowd","id":15893550,"avatar_url":"https://avatars.githubusercontent.com/u/15893550?v=3","gravatar_id":"","url":"https://api.github.com/users/coolcrowd","html_url":"https://github.com/coolcrowd","followers_url":"https://api.github.com/users/coolcrowd/followers","following_url":"https://api.github.com/users/coolcrowd/following{/other_user}","gists_url":"https://api.github.com/users/coolcrowd/gists{/gist_id}","starred_url":"https://api.github.com/users/coolcrowd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolcrowd/subscriptions","organizations_url":"https://api.github.com/users/coolcrowd/orgs","repos_url":"https://api.github.com/users/coolcrowd/repos","events_url":"https://api.github.com/users/coolcrowd/events{/privacy}","received_events_url":"https://api.github.com/users/coolcrowd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coolcrowd/object-service","description":"Central API service.","fork":false,"url":"https://api.github.com/repos/coolcrowd/object-service","forks_url":"https://api.github.com/repos/coolcrowd/object-service/forks","keys_url":"https://api.github.com/repos/coolcrowd/object-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coolcrowd/object-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coolcrowd/object-service/teams","hooks_url":"https://api.github.com/repos/coolcrowd/object-service/hooks","issue_events_url":"https://api.github.com/repos/coolcrowd/object-service/issues/events{/number}","events_url":"https://api.github.com/repos/coolcrowd/object-service/events","assignees_url":"https://api.github.com/repos/coolcrowd/object-service/assignees{/user}","branches_url":"https://api.github.com/repos/coolcrowd/object-service/branches{/branch}","tags_url":"https://api.github.com/repos/coolcrowd/object-service/tags","blobs_url":"https://api.github.com/repos/coolcrowd/object-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coolcrowd/object-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coolcrowd/object-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/coolcrowd/object-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coolcrowd/object-service/statuses/{sha}","languages_url":"https://api.github.com/repos/coolcrowd/object-service/languages","stargazers_url":"https://api.github.com/repos/coolcrowd/object-service/stargazers","contributors_url":"https://api.github.com/repos/coolcrowd/object-service/contributors","subscribers_url":"https://api.github.com/repos/coolcrowd/object-service/subscribers","subscription_url":"https://api.github.com/repos/coolcrowd/object-service/subscription","commits_url":"https://api.github.com/repos/coolcrowd/object-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/coolcrowd/object-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/coolcrowd/object-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/coolcrowd/object-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/coolcrowd/object-service/contents/{+path}","compare_url":"https://api.github.com/repos/coolcrowd/object-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coolcrowd/object-service/merges","archive_url":"https://api.github.com/repos/coolcrowd/object-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coolcrowd/object-service/downloads","issues_url":"https://api.github.com/repos/coolcrowd/object-service/issues{/number}","pulls_url":"https://api.github.com/repos/coolcrowd/object-service/pulls{/number}","milestones_url":"https://api.github.com/repos/coolcrowd/object-service/milestones{/number}","notifications_url":"https://api.github.com/repos/coolcrowd/object-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coolcrowd/object-service/labels{/name}","releases_url":"https://api.github.com/repos/coolcrowd/object-service/releases{/id}","deployments_url":"https://api.github.com/repos/coolcrowd/object-service/deployments","created_at":"2015-11-19T17:35:07Z","updated_at":"2016-02-07T10:23:14Z","pushed_at":"2016-02-08T15:48:50Z","git_url":"git://github.com/coolcrowd/object-service.git","ssh_url":"git@github.com:coolcrowd/object-service.git","clone_url":"https://github.com/coolcrowd/object-service.git","svn_url":"https://github.com/coolcrowd/object-service","homepage":"","size":12836,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"coolcrowd:master","ref":"master","sha":"6365bbf52374af3b6960645a87e23b8ce0d0b0f1","user":{"login":"coolcrowd","id":15893550,"avatar_url":"https://avatars.githubusercontent.com/u/15893550?v=3","gravatar_id":"","url":"https://api.github.com/users/coolcrowd","html_url":"https://github.com/coolcrowd","followers_url":"https://api.github.com/users/coolcrowd/followers","following_url":"https://api.github.com/users/coolcrowd/following{/other_user}","gists_url":"https://api.github.com/users/coolcrowd/gists{/gist_id}","starred_url":"https://api.github.com/users/coolcrowd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolcrowd/subscriptions","organizations_url":"https://api.github.com/users/coolcrowd/orgs","repos_url":"https://api.github.com/users/coolcrowd/repos","events_url":"https://api.github.com/users/coolcrowd/events{/privacy}","received_events_url":"https://api.github.com/users/coolcrowd/received_events","type":"Organization","site_admin":false},"repo":{"id":46509189,"name":"object-service","full_name":"coolcrowd/object-service","owner":{"login":"coolcrowd","id":15893550,"avatar_url":"https://avatars.githubusercontent.com/u/15893550?v=3","gravatar_id":"","url":"https://api.github.com/users/coolcrowd","html_url":"https://github.com/coolcrowd","followers_url":"https://api.github.com/users/coolcrowd/followers","following_url":"https://api.github.com/users/coolcrowd/following{/other_user}","gists_url":"https://api.github.com/users/coolcrowd/gists{/gist_id}","starred_url":"https://api.github.com/users/coolcrowd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolcrowd/subscriptions","organizations_url":"https://api.github.com/users/coolcrowd/orgs","repos_url":"https://api.github.com/users/coolcrowd/repos","events_url":"https://api.github.com/users/coolcrowd/events{/privacy}","received_events_url":"https://api.github.com/users/coolcrowd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coolcrowd/object-service","description":"Central API service.","fork":false,"url":"https://api.github.com/repos/coolcrowd/object-service","forks_url":"https://api.github.com/repos/coolcrowd/object-service/forks","keys_url":"https://api.github.com/repos/coolcrowd/object-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coolcrowd/object-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coolcrowd/object-service/teams","hooks_url":"https://api.github.com/repos/coolcrowd/object-service/hooks","issue_events_url":"https://api.github.com/repos/coolcrowd/object-service/issues/events{/number}","events_url":"https://api.github.com/repos/coolcrowd/object-service/events","assignees_url":"https://api.github.com/repos/coolcrowd/object-service/assignees{/user}","branches_url":"https://api.github.com/repos/coolcrowd/object-service/branches{/branch}","tags_url":"https://api.github.com/repos/coolcrowd/object-service/tags","blobs_url":"https://api.github.com/repos/coolcrowd/object-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coolcrowd/object-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coolcrowd/object-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/coolcrowd/object-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coolcrowd/object-service/statuses/{sha}","languages_url":"https://api.github.com/repos/coolcrowd/object-service/languages","stargazers_url":"https://api.github.com/repos/coolcrowd/object-service/stargazers","contributors_url":"https://api.github.com/repos/coolcrowd/object-service/contributors","subscribers_url":"https://api.github.com/repos/coolcrowd/object-service/subscribers","subscription_url":"https://api.github.com/repos/coolcrowd/object-service/subscription","commits_url":"https://api.github.com/repos/coolcrowd/object-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/coolcrowd/object-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/coolcrowd/object-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/coolcrowd/object-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/coolcrowd/object-service/contents/{+path}","compare_url":"https://api.github.com/repos/coolcrowd/object-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coolcrowd/object-service/merges","archive_url":"https://api.github.com/repos/coolcrowd/object-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coolcrowd/object-service/downloads","issues_url":"https://api.github.com/repos/coolcrowd/object-service/issues{/number}","pulls_url":"https://api.github.com/repos/coolcrowd/object-service/pulls{/number}","milestones_url":"https://api.github.com/repos/coolcrowd/object-service/milestones{/number}","notifications_url":"https://api.github.com/repos/coolcrowd/object-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coolcrowd/object-service/labels{/name}","releases_url":"https://api.github.com/repos/coolcrowd/object-service/releases{/id}","deployments_url":"https://api.github.com/repos/coolcrowd/object-service/deployments","created_at":"2015-11-19T17:35:07Z","updated_at":"2016-02-07T10:23:14Z","pushed_at":"2016-02-08T15:48:50Z","git_url":"git://github.com/coolcrowd/object-service.git","ssh_url":"git@github.com:coolcrowd/object-service.git","clone_url":"https://github.com/coolcrowd/object-service.git","svn_url":"https://github.com/coolcrowd/object-service","homepage":"","size":12836,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/108"},"html":{"href":"https://github.com/coolcrowd/object-service/pull/108"},"issue":{"href":"https://api.github.com/repos/coolcrowd/object-service/issues/108"},"comments":{"href":"https://api.github.com/repos/coolcrowd/object-service/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coolcrowd/object-service/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/coolcrowd/object-service/statuses/2720e446d64fa3d204fdab8878a5739db5b61a97"}}}}