GitHub PullRequestReviewCommentEvent at 2014-09-05 13:16:56
Repository: conf-registration-api
Actor: ryancarlson
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/comments/17171393","id":17171393,"diff_hunk":"@@ -22,84 +25,114 @@\n {\n \tprivate static final long serialVersionUID = 1L;\n \n-    private UUID id;\n-    private UUID registrationId;\n-    private UUID userId;\n-    private UUID registrantTypeId;\n+\tprivate UUID id;\n+\tprivate UUID registrationId;\n+\tprivate UUID userId;\n+\tprivate UUID registrantTypeId;\n \tprivate BigDecimal totalDue;\n-    private DateTime createdTimestamp;\n-    private DateTime lastUpdatedTimestamp;\n+\tprivate DateTime createdTimestamp;\n+\tprivate DateTime lastUpdatedTimestamp;\n \tprivate boolean isLoggedInUser;\n+\tprivate BigDecimal minimumDeposit;\n+\tprivate BigDecimal discounts;\n \n-    private Set<Answer> answers = Sets.newHashSet();\n+\tprivate Set<Answer> answers = Sets.newHashSet();\n \n \t/**\n \t * Creates a web api friendly registrant\n-\t * \n+\t *\n \t * @param dbRegistrant\n \t * @return\n \t */\n \tpublic static Registrant fromDb(RegistrantEntity dbRegistrant)\n \t{\n \t\tif(dbRegistrant == null) return null;\n-\t\t\n+\n \t\tRegistrant webRegistrant = new Registrant();\n-\t\t\n+\n \t\twebRegistrant.id = dbRegistrant.getId();\n-        webRegistrant.registrationId = dbRegistrant.getRegistrationId();\n-        webRegistrant.userId = dbRegistrant.getPersonId();\n-        webRegistrant.registrantTypeId = dbRegistrant.getRegistrantTypeId();\n+\t\twebRegistrant.registrationId = dbRegistrant.getRegistrationId();\n+\t\twebRegistrant.userId = dbRegistrant.getPersonId();\n+\t\twebRegistrant.registrantTypeId = dbRegistrant.getRegistrantTypeId();\n \t\twebRegistrant.totalDue = dbRegistrant.getTotalDue();\n-        webRegistrant.createdTimestamp = dbRegistrant.getCreatedTimestamp();\n-        webRegistrant.lastUpdatedTimestamp = dbRegistrant.getLastUpdatedTimestamp();\n-        \n-        return webRegistrant;\n+\t\twebRegistrant.createdTimestamp = dbRegistrant.getCreatedTimestamp();\n+\t\twebRegistrant.lastUpdatedTimestamp = dbRegistrant.getLastUpdatedTimestamp();\n+\n+\t\treturn webRegistrant;\n \t}\n-\t\n+\n \tpublic static Registrant fromDb(RegistrantEntity dbRegistrant, List<AnswerEntity> dbAnswers)\n \t{\n \t\tRegistrant webRegistrant = fromDb(dbRegistrant);\n-\t\t\n+\n \t\tif(webRegistrant == null) return null;\n \n-        if(dbAnswers != null)\n-        {\n-            webRegistrant.answers = Sets.newHashSet();\n-            for(AnswerEntity dbAnswer : dbAnswers)\n-            {\n-                webRegistrant.answers.add(Answer.fromDb(dbAnswer));\n-            }\n-        }\n+\t\tif(dbAnswers != null)\n+\t\t{\n+\t\t\twebRegistrant.answers = Sets.newHashSet();\n+\t\t\tfor(AnswerEntity dbAnswer : dbAnswers)\n+\t\t\t{\n+\t\t\t\twebRegistrant.answers.add(Answer.fromDb(dbAnswer));\n+\t\t\t}\n+\t\t}\n \n \t\treturn webRegistrant;\n \t}\n-\t\n+\n \tpublic static Set<Registrant> fromDb(Set<RegistrantEntity> dbRegistrants)\n \t{\n \t\tSet<Registrant> registrants = new HashSet<Registrant>();\n-\t\t\n+\n \t\tfor(RegistrantEntity dbRegistrant : dbRegistrants)\n \t\t{\n \t\t\tregistrants.add(fromDb(dbRegistrant));\n \t\t}\n-\t\t\n+\n \t\treturn registrants;\n \t}\n-\t\n+\n \tpublic RegistrantEntity toDbRegistrantEntity()\n \t{\n \t\tRegistrantEntity dbRegistrant = new RegistrantEntity();\n-\t\t\n+\n \t\tdbRegistrant.setId(id);\n \t\tdbRegistrant.setRegistrationId(registrationId);\n \t\tdbRegistrant.setPersonId(userId);\n-        dbRegistrant.setRegistrantTypeId(registrantTypeId);\n-\t\t/*total due is omitted b/c that value doesn't typically come from the client.  administrators\n-\t\t * can override the total due, but that is handled specifically in UpdateRegistrationProcess*/\n-\t\t\n+\t\tdbRegistrant.setRegistrantTypeId(registrantTypeId);\n+\t\tdbRegistrant.setTotalDue(totalDue);\n+\n \t\treturn dbRegistrant;\n \t}\n \n+\tpublic Registrant calculateTotalsDue(RegistrantTypeEntity registrantTypeEntity, ConferenceEntity conferenceEntity, Clock clock)\n+\t{\n+\t\tif (registrantTypeEntity != null)\n+\t\t{\n+\t\t\tthis.setTotalDue(registrantTypeEntity.getCost() == null ? BigDecimal.ZERO : registrantTypeEntity.getCost());\n+\t\t\tthis.setMinimumDeposit(registrantTypeEntity.getMinimumDeposit() == null ? BigDecimal.ZERO : registrantTypeEntity.getMinimumDeposit());\n+\n+\t\t\tif (registrantTypeEntity.isEarlyRegistrationDiscount() &&\n+\t\t\t\t\tregistrantTypeEntity.getEarlyRegistrationCutoff() != null &&\n+\t\t\t\t\tclock.currentDateTime().isBefore(registrantTypeEntity.getEarlyRegistrationCutoff().toDateTime(conferenceEntity.getEventTimezone())))\n+\t\t\t{\n+\t\t\t\tthis.setDiscounts(registrantTypeEntity.getEarlyRegistrationAmount() == null ? BigDecimal.ZERO : registrantTypeEntity.getEarlyRegistrationAmount());\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tthis.setDiscounts(new BigDecimal(0));","path":"src/main/java/org/cru/crs/api/model/Registrant.java","position":149,"original_position":149,"commit_id":"f5fdfad17e84f61d2494cf3d5bda5f39125dacd6","original_commit_id":"f5fdfad17e84f61d2494cf3d5bda5f39125dacd6","user":{"login":"ryancarlson","id":3768029,"avatar_url":"https://avatars.githubusercontent.com/u/3768029?v=2","gravatar_id":"e08062f49f466891c09609353478cfbe","url":"https://api.github.com/users/ryancarlson","html_url":"https://github.com/ryancarlson","followers_url":"https://api.github.com/users/ryancarlson/followers","following_url":"https://api.github.com/users/ryancarlson/following{/other_user}","gists_url":"https://api.github.com/users/ryancarlson/gists{/gist_id}","starred_url":"https://api.github.com/users/ryancarlson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryancarlson/subscriptions","organizations_url":"https://api.github.com/users/ryancarlson/orgs","repos_url":"https://api.github.com/users/ryancarlson/repos","events_url":"https://api.github.com/users/ryancarlson/events{/privacy}","received_events_url":"https://api.github.com/users/ryancarlson/received_events","type":"User","site_admin":false},"body":"This can also be BigDecimal.ZERO","created_at":"2014-09-05T13:16:56Z","updated_at":"2014-09-05T13:16:56Z","html_url":"https://github.com/CruGlobal/conf-registration-api/pull/237#discussion_r17171393","pull_request_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237","_links":{"self":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/comments/17171393"},"html":{"href":"https://github.com/CruGlobal/conf-registration-api/pull/237#discussion_r17171393"},"pull_request":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237"}}},"pull_request":{"url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237","id":20687327,"html_url":"https://github.com/CruGlobal/conf-registration-api/pull/237","diff_url":"https://github.com/CruGlobal/conf-registration-api/pull/237.diff","patch_url":"https://github.com/CruGlobal/conf-registration-api/pull/237.patch","issue_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/237","number":237,"state":"open","locked":false,"title":"Event 58","user":{"login":"mattfred","id":8041146,"avatar_url":"https://avatars.githubusercontent.com/u/8041146?v=2","gravatar_id":"01bc543966b1ba27aa5dc3cf83a30db3","url":"https://api.github.com/users/mattfred","html_url":"https://github.com/mattfred","followers_url":"https://api.github.com/users/mattfred/followers","following_url":"https://api.github.com/users/mattfred/following{/other_user}","gists_url":"https://api.github.com/users/mattfred/gists{/gist_id}","starred_url":"https://api.github.com/users/mattfred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattfred/subscriptions","organizations_url":"https://api.github.com/users/mattfred/orgs","repos_url":"https://api.github.com/users/mattfred/repos","events_url":"https://api.github.com/users/mattfred/events{/privacy}","received_events_url":"https://api.github.com/users/mattfred/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-09-03T16:07:57Z","updated_at":"2014-09-05T13:16:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb00440d24cb22030a735d0de6ef011fe3184723","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237/commits","review_comments_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237/comments","review_comment_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/comments/{number}","comments_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/237/comments","statuses_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/statuses/f5fdfad17e84f61d2494cf3d5bda5f39125dacd6","head":{"label":"CruGlobal:EVENT-58","ref":"EVENT-58","sha":"f5fdfad17e84f61d2494cf3d5bda5f39125dacd6","user":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars.githubusercontent.com/u/1785912?v=2","gravatar_id":"fff0e4838db6e8e33d895977195fa2ce","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"repo":{"id":10947678,"name":"conf-registration-api","full_name":"CruGlobal/conf-registration-api","owner":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars.githubusercontent.com/u/1785912?v=2","gravatar_id":"fff0e4838db6e8e33d895977195fa2ce","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CruGlobal/conf-registration-api","description":"eventregistrationtool api","fork":false,"url":"https://api.github.com/repos/CruGlobal/conf-registration-api","forks_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/forks","keys_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/teams","hooks_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/hooks","issue_events_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/events{/number}","events_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/events","assignees_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/assignees{/user}","branches_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/branches{/branch}","tags_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/tags","blobs_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/statuses/{sha}","languages_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/languages","stargazers_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/stargazers","contributors_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/contributors","subscribers_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/subscribers","subscription_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/subscription","commits_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/contents/{+path}","compare_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/merges","archive_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/downloads","issues_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues{/number}","pulls_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls{/number}","milestones_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/milestones{/number}","notifications_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/labels{/name}","releases_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/releases{/id}","created_at":"2013-06-25T19:21:35Z","updated_at":"2014-09-02T15:51:41Z","pushed_at":"2014-09-04T19:31:45Z","git_url":"git://github.com/CruGlobal/conf-registration-api.git","ssh_url":"git@github.com:CruGlobal/conf-registration-api.git","clone_url":"https://github.com/CruGlobal/conf-registration-api.git","svn_url":"https://github.com/CruGlobal/conf-registration-api","homepage":"","size":49156,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":3,"default_branch":"master"}},"base":{"label":"CruGlobal:EVENT-24","ref":"EVENT-24","sha":"df5c4e7b57058d7e7699a6e6e4672e66d93fa97b","user":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars.githubusercontent.com/u/1785912?v=2","gravatar_id":"fff0e4838db6e8e33d895977195fa2ce","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"repo":{"id":10947678,"name":"conf-registration-api","full_name":"CruGlobal/conf-registration-api","owner":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars.githubusercontent.com/u/1785912?v=2","gravatar_id":"fff0e4838db6e8e33d895977195fa2ce","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CruGlobal/conf-registration-api","description":"eventregistrationtool api","fork":false,"url":"https://api.github.com/repos/CruGlobal/conf-registration-api","forks_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/forks","keys_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/teams","hooks_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/hooks","issue_events_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/events{/number}","events_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/events","assignees_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/assignees{/user}","branches_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/branches{/branch}","tags_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/tags","blobs_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/statuses/{sha}","languages_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/languages","stargazers_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/stargazers","contributors_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/contributors","subscribers_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/subscribers","subscription_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/subscription","commits_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/contents/{+path}","compare_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/merges","archive_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/downloads","issues_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues{/number}","pulls_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls{/number}","milestones_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/milestones{/number}","notifications_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/labels{/name}","releases_url":"https://api.github.com/repos/CruGlobal/conf-registration-api/releases{/id}","created_at":"2013-06-25T19:21:35Z","updated_at":"2014-09-02T15:51:41Z","pushed_at":"2014-09-04T19:31:45Z","git_url":"git://github.com/CruGlobal/conf-registration-api.git","ssh_url":"git@github.com:CruGlobal/conf-registration-api.git","clone_url":"https://github.com/CruGlobal/conf-registration-api.git","svn_url":"https://github.com/CruGlobal/conf-registration-api","homepage":"","size":49156,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237"},"html":{"href":"https://github.com/CruGlobal/conf-registration-api/pull/237"},"issue":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/237"},"comments":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/issues/237/comments"},"review_comments":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237/comments"},"review_comment":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/pulls/237/commits"},"statuses":{"href":"https://api.github.com/repos/CruGlobal/conf-registration-api/statuses/f5fdfad17e84f61d2494cf3d5bda5f39125dacd6"}}}}