{"action":"created","comment":{"url":"https://api.github.com/repos/fossasia/open-event-server/pulls/comments/361787596","pull_request_review_id":336909891,"id":361787596,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM2MTc4NzU5Ng==","diff_hunk":"@@ -54,6 +56,42 @@ def test_should_delete_related_attendees(self):\n             order = db.session.query(Order).filter(Order.id == obj.id).first()\n             self.assertEqual(len(order.ticket_holders), 0)\n \n+    def test_count_sold_and_reserved_tickets(self):\n+        \"\"\"Method to test the count query of sold tickets\"\"\"\n+\n+        with app.test_request_context():\n+            ticket = TicketFactory()\n+\n+            completed_order = OrderFactory(status='completed')\n+            placed_order = OrderFactory(status='placed')\n+            initializing_order = OrderFactory(status='initializing',\n+                                             created_at=datetime.utcnow() - timedelta(minutes=5))\n+            initialized_order = OrderFactory(status='initialized',\n+                                            created_at=datetime.utcnow() - timedelta(minutes=35))\n+            expired_time_order = OrderFactory(status='initializing', created_at=common.date_)\n+            expired_order = OrderFactory(status='expired')\n+\n+            db.session.commit()\n+\n+            # will not be counted as they have no order_id\n+            AttendeeFactoryBase.create_batch(2)\n+            # will be counted as attendee have valid orders\n+            AttendeeFactoryBase.create_batch(6, order_id=completed_order.id)\n+            # will be counted as attendee has valid placed order\n+            AttendeeFactoryBase(order_id=placed_order.id)\n+            # will be counted as attendee has initializing order under order expiry time\n+            AttendeeFactoryBase.create_batch(4, order_id=initializing_order.id)\n+            #will be counted as attendee has initialized order under 30+order expiry time","path":"tests/all/integration/api/helpers/test_order.py","position":47,"original_position":47,"commit_id":"eb3e56b305e0face46a9f30e1b6cf1953ac00217","original_commit_id":"eb3e56b305e0face46a9f30e1b6cf1953ac00217","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":"block comment should start with '# '","created_at":"2019-12-28T10:05:44Z","updated_at":"2019-12-28T10:05:45Z","html_url":"https://github.com/fossasia/open-event-server/pull/6693#discussion_r361787596","pull_request_url":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/comments/361787596"},"html":{"href":"https://github.com/fossasia/open-event-server/pull/6693#discussion_r361787596"},"pull_request":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693"}}},"pull_request":{"url":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693","id":356438444,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU2NDM4NDQ0","html_url":"https://github.com/fossasia/open-event-server/pull/6693","diff_url":"https://github.com/fossasia/open-event-server/pull/6693.diff","patch_url":"https://github.com/fossasia/open-event-server/pull/6693.patch","issue_url":"https://api.github.com/repos/fossasia/open-event-server/issues/6693","number":6693,"state":"open","locked":false,"title":"fix:count query of sold tickets","user":{"login":"codedsun","id":20026440,"node_id":"MDQ6VXNlcjIwMDI2NDQw","avatar_url":"https://avatars3.githubusercontent.com/u/20026440?v=4","gravatar_id":"","url":"https://api.github.com/users/codedsun","html_url":"https://github.com/codedsun","followers_url":"https://api.github.com/users/codedsun/followers","following_url":"https://api.github.com/users/codedsun/following{/other_user}","gists_url":"https://api.github.com/users/codedsun/gists{/gist_id}","starred_url":"https://api.github.com/users/codedsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codedsun/subscriptions","organizations_url":"https://api.github.com/users/codedsun/orgs","repos_url":"https://api.github.com/users/codedsun/repos","events_url":"https://api.github.com/users/codedsun/events{/privacy}","received_events_url":"https://api.github.com/users/codedsun/received_events","type":"User","site_admin":false},"body":"<!--\r\n(Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.)\r\n-->\r\n<!-- Add the issue number that is fixed by this PR (In the form Fixes #123) -->\r\n\r\nFixes #6653 \r\n\r\nhttps://github.com/fossasia/open-event-server/issues/6653#issuecomment-565030517\r\n\r\n\r\n#### Short description of what this resolves:\r\n\r\nCount query of sold tickets. Solution: Calculate only placed orders + initializing orders which were created under order expiry time\r\n\r\n#### Checklist\r\n\r\n- [x] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them.\r\n- [x] My branch is up-to-date with the Upstream `development` branch.\r\n- [x] The unit tests pass locally with my changes <!-- use `nosetests tests/all` to run all the tests -->\r\n- [x] I have added tests that prove my fix is effective or that my feature works\r\n- [x] I have added necessary documentation (if appropriate)\r\n<!-- If an existing function does not have a docstring, please add one -->\r\n- [x] All the functions created/modified in this PR contain relevant docstrings.\r\n","created_at":"2019-12-23T20:04:40Z","updated_at":"2019-12-28T10:05:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6729207e356db8a046e1fc6e27030447e7b57e0f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1312254493,"node_id":"MDU6TGFiZWwxMzEyMjU0NDkz","url":"https://api.github.com/repos/fossasia/open-event-server/labels/fix","name":"fix","color":"ffcdc1","default":false,"description":""}],"milestone":null,"commits_url":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693/commits","review_comments_url":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693/comments","review_comment_url":"https://api.github.com/repos/fossasia/open-event-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fossasia/open-event-server/issues/6693/comments","statuses_url":"https://api.github.com/repos/fossasia/open-event-server/statuses/eb3e56b305e0face46a9f30e1b6cf1953ac00217","head":{"label":"codedsun:sold-query","ref":"sold-query","sha":"eb3e56b305e0face46a9f30e1b6cf1953ac00217","user":{"login":"codedsun","id":20026440,"node_id":"MDQ6VXNlcjIwMDI2NDQw","avatar_url":"https://avatars3.githubusercontent.com/u/20026440?v=4","gravatar_id":"","url":"https://api.github.com/users/codedsun","html_url":"https://github.com/codedsun","followers_url":"https://api.github.com/users/codedsun/followers","following_url":"https://api.github.com/users/codedsun/following{/other_user}","gists_url":"https://api.github.com/users/codedsun/gists{/gist_id}","starred_url":"https://api.github.com/users/codedsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codedsun/subscriptions","organizations_url":"https://api.github.com/users/codedsun/orgs","repos_url":"https://api.github.com/users/codedsun/repos","events_url":"https://api.github.com/users/codedsun/events{/privacy}","received_events_url":"https://api.github.com/users/codedsun/received_events","type":"User","site_admin":false},"repo":{"id":132607395,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI2MDczOTU=","name":"open-event-server","full_name":"codedsun/open-event-server","private":false,"owner":{"login":"codedsun","id":20026440,"node_id":"MDQ6VXNlcjIwMDI2NDQw","avatar_url":"https://avatars3.githubusercontent.com/u/20026440?v=4","gravatar_id":"","url":"https://api.github.com/users/codedsun","html_url":"https://github.com/codedsun","followers_url":"https://api.github.com/users/codedsun/followers","following_url":"https://api.github.com/users/codedsun/following{/other_user}","gists_url":"https://api.github.com/users/codedsun/gists{/gist_id}","starred_url":"https://api.github.com/users/codedsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codedsun/subscriptions","organizations_url":"https://api.github.com/users/codedsun/orgs","repos_url":"https://api.github.com/users/codedsun/repos","events_url":"https://api.github.com/users/codedsun/events{/privacy}","received_events_url":"https://api.github.com/users/codedsun/received_events","type":"User","site_admin":false},"html_url":"https://github.com/codedsun/open-event-server","description":"The Open Event Organizer Server to Manage Events","fork":true,"url":"https://api.github.com/repos/codedsun/open-event-server","forks_url":"https://api.github.com/repos/codedsun/open-event-server/forks","keys_url":"https://api.github.com/repos/codedsun/open-event-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codedsun/open-event-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codedsun/open-event-server/teams","hooks_url":"https://api.github.com/repos/codedsun/open-event-server/hooks","issue_events_url":"https://api.github.com/repos/codedsun/open-event-server/issues/events{/number}","events_url":"https://api.github.com/repos/codedsun/open-event-server/events","assignees_url":"https://api.github.com/repos/codedsun/open-event-server/assignees{/user}","branches_url":"https://api.github.com/repos/codedsun/open-event-server/branches{/branch}","tags_url":"https://api.github.com/repos/codedsun/open-event-server/tags","blobs_url":"https://api.github.com/repos/codedsun/open-event-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codedsun/open-event-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codedsun/open-event-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/codedsun/open-event-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codedsun/open-event-server/statuses/{sha}","languages_url":"https://api.github.com/repos/codedsun/open-event-server/languages","stargazers_url":"https://api.github.com/repos/codedsun/open-event-server/stargazers","contributors_url":"https://api.github.com/repos/codedsun/open-event-server/contributors","subscribers_url":"https://api.github.com/repos/codedsun/open-event-server/subscribers","subscription_url":"https://api.github.com/repos/codedsun/open-event-server/subscription","commits_url":"https://api.github.com/repos/codedsun/open-event-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/codedsun/open-event-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/codedsun/open-event-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/codedsun/open-event-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/codedsun/open-event-server/contents/{+path}","compare_url":"https://api.github.com/repos/codedsun/open-event-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codedsun/open-event-server/merges","archive_url":"https://api.github.com/repos/codedsun/open-event-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codedsun/open-event-server/downloads","issues_url":"https://api.github.com/repos/codedsun/open-event-server/issues{/number}","pulls_url":"https://api.github.com/repos/codedsun/open-event-server/pulls{/number}","milestones_url":"https://api.github.com/repos/codedsun/open-event-server/milestones{/number}","notifications_url":"https://api.github.com/repos/codedsun/open-event-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codedsun/open-event-server/labels{/name}","releases_url":"https://api.github.com/repos/codedsun/open-event-server/releases{/id}","deployments_url":"https://api.github.com/repos/codedsun/open-event-server/deployments","created_at":"2018-05-08T12:42:31Z","updated_at":"2019-12-22T19:59:16Z","pushed_at":"2019-12-28T10:05:37Z","git_url":"git://github.com/codedsun/open-event-server.git","ssh_url":"git@github.com:codedsun/open-event-server.git","clone_url":"https://github.com/codedsun/open-event-server.git","svn_url":"https://github.com/codedsun/open-event-server","homepage":"http://open-event-api.herokuapp.com/","size":48061,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"fossasia:development","ref":"development","sha":"f27e08d744c139182c651085e53d20067970d9a0","user":{"login":"fossasia","id":6295529,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyOTU1Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/6295529?v=4","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"repo":{"id":35270176,"node_id":"MDEwOlJlcG9zaXRvcnkzNTI3MDE3Ng==","name":"open-event-server","full_name":"fossasia/open-event-server","private":false,"owner":{"login":"fossasia","id":6295529,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyOTU1Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/6295529?v=4","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/fossasia/open-event-server","description":"The Open Event Organizer Server to Manage Events https://api.eventyay.com | http://open-event-api.herokuapp.com","fork":false,"url":"https://api.github.com/repos/fossasia/open-event-server","forks_url":"https://api.github.com/repos/fossasia/open-event-server/forks","keys_url":"https://api.github.com/repos/fossasia/open-event-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fossasia/open-event-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fossasia/open-event-server/teams","hooks_url":"https://api.github.com/repos/fossasia/open-event-server/hooks","issue_events_url":"https://api.github.com/repos/fossasia/open-event-server/issues/events{/number}","events_url":"https://api.github.com/repos/fossasia/open-event-server/events","assignees_url":"https://api.github.com/repos/fossasia/open-event-server/assignees{/user}","branches_url":"https://api.github.com/repos/fossasia/open-event-server/branches{/branch}","tags_url":"https://api.github.com/repos/fossasia/open-event-server/tags","blobs_url":"https://api.github.com/repos/fossasia/open-event-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fossasia/open-event-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fossasia/open-event-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/fossasia/open-event-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fossasia/open-event-server/statuses/{sha}","languages_url":"https://api.github.com/repos/fossasia/open-event-server/languages","stargazers_url":"https://api.github.com/repos/fossasia/open-event-server/stargazers","contributors_url":"https://api.github.com/repos/fossasia/open-event-server/contributors","subscribers_url":"https://api.github.com/repos/fossasia/open-event-server/subscribers","subscription_url":"https://api.github.com/repos/fossasia/open-event-server/subscription","commits_url":"https://api.github.com/repos/fossasia/open-event-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/fossasia/open-event-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/fossasia/open-event-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/fossasia/open-event-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/fossasia/open-event-server/contents/{+path}","compare_url":"https://api.github.com/repos/fossasia/open-event-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fossasia/open-event-server/merges","archive_url":"https://api.github.com/repos/fossasia/open-event-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fossasia/open-event-server/downloads","issues_url":"https://api.github.com/repos/fossasia/open-event-server/issues{/number}","pulls_url":"https://api.github.com/repos/fossasia/open-event-server/pulls{/number}","milestones_url":"https://api.github.com/repos/fossasia/open-event-server/milestones{/number}","notifications_url":"https://api.github.com/repos/fossasia/open-event-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fossasia/open-event-server/labels{/name}","releases_url":"https://api.github.com/repos/fossasia/open-event-server/releases{/id}","deployments_url":"https://api.github.com/repos/fossasia/open-event-server/deployments","created_at":"2015-05-08T09:16:19Z","updated_at":"2019-12-28T07:58:58Z","pushed_at":"2019-12-28T10:05:40Z","git_url":"git://github.com/fossasia/open-event-server.git","ssh_url":"git@github.com:fossasia/open-event-server.git","clone_url":"https://github.com/fossasia/open-event-server.git","svn_url":"https://github.com/fossasia/open-event-server","homepage":"","size":48398,"stargazers_count":2115,"watchers_count":2115,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1413,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":134,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":1413,"open_issues":134,"watchers":2115,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693"},"html":{"href":"https://github.com/fossasia/open-event-server/pull/6693"},"issue":{"href":"https://api.github.com/repos/fossasia/open-event-server/issues/6693"},"comments":{"href":"https://api.github.com/repos/fossasia/open-event-server/issues/6693/comments"},"review_comments":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693/comments"},"review_comment":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fossasia/open-event-server/pulls/6693/commits"},"statuses":{"href":"https://api.github.com/repos/fossasia/open-event-server/statuses/eb3e56b305e0face46a9f30e1b6cf1953ac00217"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}