{"action":"created","comment":{"url":"https://api.github.com/repos/kaltura/server/pulls/comments/32608448","id":32608448,"diff_hunk":"@@ -0,0 +1,91 @@\n+<?php\n+/**\n+ * @package plugins.quiz\n+ * @subpackage model\n+ */\n+\n+class AnswerCuePoint extends CuePoint\n+{\n+\tconst CUSTOM_DATA_QUIZ_USER_ENTRY_ID= 'quizUserEntryId';\n+\tconst CUSTOM_DATA_ANSWER_KEY = 'answerKey';\n+\tconst CUSTOM_DATA_IS_CORRECT = 'isCorrect';\n+\tconst CUSTOM_DATA_CORRECT_ANSWER_KEYS = 'correctAnswerKeys';\n+\tconst CUSTOM_DATA_EXPLANATION= 'explanation';\n+\n+\tpublic function __construct()\n+\t{\n+\t\tparent::__construct();\n+\t\t$this->applyDefaultValues();\n+\t}\n+\n+\t/**\n+\t * Applies default values to this object.\n+\t * This method should be called from the object's constructor (or equivalent initialization method).\n+\t * @see __construct()\n+\t */\n+\tpublic function applyDefaultValues()\n+\t{\n+\t\t$this->setType(QuizPlugin::getCuePointTypeCoreValue(QuizCuePointType::QUIZ_ANSWER));\n+\t}\n+\n+\tpublic function setQuizUserEntryId($v) {return $this->putInCustomData(self::CUSTOM_DATA_QUIZ_USER_ENTRY_ID, $v);}\n+\n+\tpublic function getQuizUserEntryId() {return $this->getFromCustomData(self::CUSTOM_DATA_QUIZ_USER_ENTRY_ID);}\n+\n+\tpublic function setAnswerKey($v) {return $this->putInCustomData(self::CUSTOM_DATA_ANSWER_KEY, $v);}\n+\n+\tpublic function getAnswerKey() {return $this->getFromCustomData(self::CUSTOM_DATA_ANSWER_KEY);}\n+\n+\tpublic function setIsCorrect($v) {return $this->putInCustomData(self::CUSTOM_DATA_IS_CORRECT, $v);}\n+\n+\tpublic function getIsCorrect() {return $this->getFromCustomData(self::CUSTOM_DATA_IS_CORRECT);}\n+\n+\tpublic function setCorrectAnswerKeys($v) {return $this->putInCustomData(self::CUSTOM_DATA_CORRECT_ANSWER_KEYS, $v);}\n+\n+\tpublic function getCorrectAnswerKeys() {return $this->getFromCustomData(self::CUSTOM_DATA_CORRECT_ANSWER_KEYS);}\n+\n+\tpublic function setExplanation($v) {return $this->putInCustomData(self::CUSTOM_DATA_EXPLANATION, $v);}\n+\n+\tpublic function getExplanation() {return $this->getFromCustomData(self::CUSTOM_DATA_EXPLANATION);}\n+\n+\tpublic function copyToClipEntry( entry $clipEntry, $clipStartTime, $clipDuration )\n+\t{\n+\t\treturn false;\n+\t}\n+\n+\n+\t/** (non-PHPdoc)\n+    * @see BaseCuePoint::preInsert()\n+    */\n+\tpublic function preInsert(PropelPDO $con = null)\n+\t{\n+\t\t$dbParentCuePoint = CuePointPeer::retrieveByPK($this->getParentId());\n+\t\t$optionalAnswers =  $dbParentCuePoint->getOptionalAnswers();\n+\t\t$correctKeys = array();\n+\t\tforeach ($optionalAnswers as $answer)\n+\t\t{\n+\t\t\tif ( $answer->getIsCorrect() )\n+\t\t\t\t$correctKeys[] = $answer->getKey();\n+\t\t}\n+\t\t$this->setCorrectAnswerKeys( $correctKeys );\n+\t\t$this->setExplanation( $dbParentCuePoint->getExplanation() );\n+\t\t$this->setIsCorrect( in_array( $this->getAnswerKey(), $correctKeys ) );\n+\t\tparent::preInsert($con);\n+\t}\n+\n+\t/**\n+\t * Code to be run before persisting the object\n+\t * @param PropelPDO $con\n+\t * @return bloolean\n+\t */\n+\tpublic function preSave(PropelPDO $con = null)","path":"plugins/cue_points/quiz/lib/model/AnswerCuePoint.php","position":81,"original_position":81,"commit_id":"3399ddee0a8a874666c72c8ef5054f57cf94f2a4","original_commit_id":"3399ddee0a8a874666c72c8ef5054f57cf94f2a4","user":{"login":"tan-tan-kanarek","id":1793469,"avatar_url":"https://avatars.githubusercontent.com/u/1793469?v=3","gravatar_id":"","url":"https://api.github.com/users/tan-tan-kanarek","html_url":"https://github.com/tan-tan-kanarek","followers_url":"https://api.github.com/users/tan-tan-kanarek/followers","following_url":"https://api.github.com/users/tan-tan-kanarek/following{/other_user}","gists_url":"https://api.github.com/users/tan-tan-kanarek/gists{/gist_id}","starred_url":"https://api.github.com/users/tan-tan-kanarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tan-tan-kanarek/subscriptions","organizations_url":"https://api.github.com/users/tan-tan-kanarek/orgs","repos_url":"https://api.github.com/users/tan-tan-kanarek/repos","events_url":"https://api.github.com/users/tan-tan-kanarek/events{/privacy}","received_events_url":"https://api.github.com/users/tan-tan-kanarek/received_events","type":"User","site_admin":false},"body":"preSave is called also before preInsert, please use preUpdate instead, the preInsert already calls setIsCorrect.","created_at":"2015-06-17T09:22:45Z","updated_at":"2015-06-17T09:22:45Z","html_url":"https://github.com/kaltura/server/pull/2683#discussion_r32608448","pull_request_url":"https://api.github.com/repos/kaltura/server/pulls/2683","_links":{"self":{"href":"https://api.github.com/repos/kaltura/server/pulls/comments/32608448"},"html":{"href":"https://github.com/kaltura/server/pull/2683#discussion_r32608448"},"pull_request":{"href":"https://api.github.com/repos/kaltura/server/pulls/2683"}}},"pull_request":{"url":"https://api.github.com/repos/kaltura/server/pulls/2683","id":37690378,"html_url":"https://github.com/kaltura/server/pull/2683","diff_url":"https://github.com/kaltura/server/pull/2683.diff","patch_url":"https://github.com/kaltura/server/pull/2683.patch","issue_url":"https://api.github.com/repos/kaltura/server/issues/2683","number":2683,"state":"closed","locked":false,"title":"Jupiter 10.9.0 in video quiz","user":{"login":"noam-arad","id":10695977,"avatar_url":"https://avatars.githubusercontent.com/u/10695977?v=3","gravatar_id":"","url":"https://api.github.com/users/noam-arad","html_url":"https://github.com/noam-arad","followers_url":"https://api.github.com/users/noam-arad/followers","following_url":"https://api.github.com/users/noam-arad/following{/other_user}","gists_url":"https://api.github.com/users/noam-arad/gists{/gist_id}","starred_url":"https://api.github.com/users/noam-arad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noam-arad/subscriptions","organizations_url":"https://api.github.com/users/noam-arad/orgs","repos_url":"https://api.github.com/users/noam-arad/repos","events_url":"https://api.github.com/users/noam-arad/events{/privacy}","received_events_url":"https://api.github.com/users/noam-arad/received_events","type":"User","site_admin":false},"body":"Reviewed by @MosheMaorKaltura .","created_at":"2015-06-15T13:21:49Z","updated_at":"2015-06-17T09:22:45Z","closed_at":"2015-06-17T08:50:38Z","merged_at":"2015-06-17T08:50:38Z","merge_commit_sha":"05cecf4cbf98413ae57e7c590356b4cca942c229","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kaltura/server/pulls/2683/commits","review_comments_url":"https://api.github.com/repos/kaltura/server/pulls/2683/comments","review_comment_url":"https://api.github.com/repos/kaltura/server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kaltura/server/issues/2683/comments","statuses_url":"https://api.github.com/repos/kaltura/server/statuses/3399ddee0a8a874666c72c8ef5054f57cf94f2a4","head":{"label":"kaltura:Jupiter-10.9.0-inVideoQuiz","ref":"Jupiter-10.9.0-inVideoQuiz","sha":"3399ddee0a8a874666c72c8ef5054f57cf94f2a4","user":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"repo":{"id":11364783,"name":"server","full_name":"kaltura/server","owner":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaltura/server","description":"The official Kaltura server. ","fork":false,"url":"https://api.github.com/repos/kaltura/server","forks_url":"https://api.github.com/repos/kaltura/server/forks","keys_url":"https://api.github.com/repos/kaltura/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaltura/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaltura/server/teams","hooks_url":"https://api.github.com/repos/kaltura/server/hooks","issue_events_url":"https://api.github.com/repos/kaltura/server/issues/events{/number}","events_url":"https://api.github.com/repos/kaltura/server/events","assignees_url":"https://api.github.com/repos/kaltura/server/assignees{/user}","branches_url":"https://api.github.com/repos/kaltura/server/branches{/branch}","tags_url":"https://api.github.com/repos/kaltura/server/tags","blobs_url":"https://api.github.com/repos/kaltura/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaltura/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaltura/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaltura/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaltura/server/statuses/{sha}","languages_url":"https://api.github.com/repos/kaltura/server/languages","stargazers_url":"https://api.github.com/repos/kaltura/server/stargazers","contributors_url":"https://api.github.com/repos/kaltura/server/contributors","subscribers_url":"https://api.github.com/repos/kaltura/server/subscribers","subscription_url":"https://api.github.com/repos/kaltura/server/subscription","commits_url":"https://api.github.com/repos/kaltura/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaltura/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaltura/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaltura/server/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaltura/server/contents/{+path}","compare_url":"https://api.github.com/repos/kaltura/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaltura/server/merges","archive_url":"https://api.github.com/repos/kaltura/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaltura/server/downloads","issues_url":"https://api.github.com/repos/kaltura/server/issues{/number}","pulls_url":"https://api.github.com/repos/kaltura/server/pulls{/number}","milestones_url":"https://api.github.com/repos/kaltura/server/milestones{/number}","notifications_url":"https://api.github.com/repos/kaltura/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaltura/server/labels{/name}","releases_url":"https://api.github.com/repos/kaltura/server/releases{/id}","created_at":"2013-07-12T08:59:26Z","updated_at":"2015-06-15T23:28:57Z","pushed_at":"2015-06-17T09:07:45Z","git_url":"git://github.com/kaltura/server.git","ssh_url":"git@github.com:kaltura/server.git","clone_url":"https://github.com/kaltura/server.git","svn_url":"https://github.com/kaltura/server","homepage":"http://www.kaltura.org","size":823638,"stargazers_count":54,"watchers_count":54,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":74,"forks":58,"open_issues":74,"watchers":54,"default_branch":"Jupiter-10.14.0"}},"base":{"label":"kaltura:Jupiter-10.14.0","ref":"Jupiter-10.14.0","sha":"e1bc2b17d601c1db8b68e47652d12bd88abd95de","user":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"repo":{"id":11364783,"name":"server","full_name":"kaltura/server","owner":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaltura/server","description":"The official Kaltura server. ","fork":false,"url":"https://api.github.com/repos/kaltura/server","forks_url":"https://api.github.com/repos/kaltura/server/forks","keys_url":"https://api.github.com/repos/kaltura/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaltura/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaltura/server/teams","hooks_url":"https://api.github.com/repos/kaltura/server/hooks","issue_events_url":"https://api.github.com/repos/kaltura/server/issues/events{/number}","events_url":"https://api.github.com/repos/kaltura/server/events","assignees_url":"https://api.github.com/repos/kaltura/server/assignees{/user}","branches_url":"https://api.github.com/repos/kaltura/server/branches{/branch}","tags_url":"https://api.github.com/repos/kaltura/server/tags","blobs_url":"https://api.github.com/repos/kaltura/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaltura/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaltura/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaltura/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaltura/server/statuses/{sha}","languages_url":"https://api.github.com/repos/kaltura/server/languages","stargazers_url":"https://api.github.com/repos/kaltura/server/stargazers","contributors_url":"https://api.github.com/repos/kaltura/server/contributors","subscribers_url":"https://api.github.com/repos/kaltura/server/subscribers","subscription_url":"https://api.github.com/repos/kaltura/server/subscription","commits_url":"https://api.github.com/repos/kaltura/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaltura/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaltura/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaltura/server/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaltura/server/contents/{+path}","compare_url":"https://api.github.com/repos/kaltura/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaltura/server/merges","archive_url":"https://api.github.com/repos/kaltura/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaltura/server/downloads","issues_url":"https://api.github.com/repos/kaltura/server/issues{/number}","pulls_url":"https://api.github.com/repos/kaltura/server/pulls{/number}","milestones_url":"https://api.github.com/repos/kaltura/server/milestones{/number}","notifications_url":"https://api.github.com/repos/kaltura/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaltura/server/labels{/name}","releases_url":"https://api.github.com/repos/kaltura/server/releases{/id}","created_at":"2013-07-12T08:59:26Z","updated_at":"2015-06-15T23:28:57Z","pushed_at":"2015-06-17T09:07:45Z","git_url":"git://github.com/kaltura/server.git","ssh_url":"git@github.com:kaltura/server.git","clone_url":"https://github.com/kaltura/server.git","svn_url":"https://github.com/kaltura/server","homepage":"http://www.kaltura.org","size":823638,"stargazers_count":54,"watchers_count":54,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":74,"forks":58,"open_issues":74,"watchers":54,"default_branch":"Jupiter-10.14.0"}},"_links":{"self":{"href":"https://api.github.com/repos/kaltura/server/pulls/2683"},"html":{"href":"https://github.com/kaltura/server/pull/2683"},"issue":{"href":"https://api.github.com/repos/kaltura/server/issues/2683"},"comments":{"href":"https://api.github.com/repos/kaltura/server/issues/2683/comments"},"review_comments":{"href":"https://api.github.com/repos/kaltura/server/pulls/2683/comments"},"review_comment":{"href":"https://api.github.com/repos/kaltura/server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kaltura/server/pulls/2683/commits"},"statuses":{"href":"https://api.github.com/repos/kaltura/server/statuses/3399ddee0a8a874666c72c8ef5054f57cf94f2a4"}}}}