{"action":"created","issue":{"url":"https://api.github.com/repos/yuha0/applechecker/issues/3","repository_url":"https://api.github.com/repos/yuha0/applechecker","labels_url":"https://api.github.com/repos/yuha0/applechecker/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/yuha0/applechecker/issues/3/comments","events_url":"https://api.github.com/repos/yuha0/applechecker/issues/3/events","html_url":"https://github.com/yuha0/applechecker/pull/3","id":178219452,"number":3,"title":"Reordered some statements for better functionality. ","user":{"login":"XcodeNinja","id":21093976,"avatar_url":"https://avatars.githubusercontent.com/u/21093976?v=3","gravatar_id":"","url":"https://api.github.com/users/XcodeNinja","html_url":"https://github.com/XcodeNinja","followers_url":"https://api.github.com/users/XcodeNinja/followers","following_url":"https://api.github.com/users/XcodeNinja/following{/other_user}","gists_url":"https://api.github.com/users/XcodeNinja/gists{/gist_id}","starred_url":"https://api.github.com/users/XcodeNinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XcodeNinja/subscriptions","organizations_url":"https://api.github.com/users/XcodeNinja/orgs","repos_url":"https://api.github.com/users/XcodeNinja/repos","events_url":"https://api.github.com/users/XcodeNinja/events{/privacy}","received_events_url":"https://api.github.com/users/XcodeNinja/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-21T01:05:11Z","updated_at":"2016-09-21T02:29:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yuha0/applechecker/pulls/3","html_url":"https://github.com/yuha0/applechecker/pull/3","diff_url":"https://github.com/yuha0/applechecker/pull/3.diff","patch_url":"https://github.com/yuha0/applechecker/pull/3.patch"},"body":"Moved the `sleep` call to the bottom of `check_stock` so the loop would execute for the first time immediately after script was started.\r\n\r\nAlso moved the check for `good_stores` to the bottom, just above the `sleep` call so the information in the print statements here wouldn't be outdated by amount of time passed in in the sec variable.\r\n\r\nAdded a print statement if no `good_stores` exists at the end of the loop.\r\n\r\nIf the loop delay is short like the default of 5 seconds, these changes probably aren't a big deal. When setting the delay to something longer... like 5 min or more I think these changes are a pretty decent improvement.\r\n\r\nI added the extra print statement when no stock exists because when I ran the script the first time I didn't have any indication of what was happening in the console after the initial print statement and text message."},"comment":{"url":"https://api.github.com/repos/yuha0/applechecker/issues/comments/248493848","html_url":"https://github.com/yuha0/applechecker/pull/3#issuecomment-248493848","issue_url":"https://api.github.com/repos/yuha0/applechecker/issues/3","id":248493848,"user":{"login":"yuha0","id":3008244,"avatar_url":"https://avatars.githubusercontent.com/u/3008244?v=3","gravatar_id":"","url":"https://api.github.com/users/yuha0","html_url":"https://github.com/yuha0","followers_url":"https://api.github.com/users/yuha0/followers","following_url":"https://api.github.com/users/yuha0/following{/other_user}","gists_url":"https://api.github.com/users/yuha0/gists{/gist_id}","starred_url":"https://api.github.com/users/yuha0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuha0/subscriptions","organizations_url":"https://api.github.com/users/yuha0/orgs","repos_url":"https://api.github.com/users/yuha0/repos","events_url":"https://api.github.com/users/yuha0/events{/privacy}","received_events_url":"https://api.github.com/users/yuha0/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T02:29:17Z","updated_at":"2016-09-21T02:29:17Z","body":"The `continue` on line 31 will skip the `sleep` call in case of some exceptions.\r\n\r\nAlso, print thousands of lines of \"Checked, but no stock found\" is not very helpful. If the only reason for this is to tell the user the script is still working on it and is not dead, maybe we can just refresh a loading sign on the same line?\r\n\r\nFor example, do you think if something like this could be better?\r\n\r\n```python\r\nimport time\r\nimport sys\r\n\r\nloading = ['-', '\\\\', '|', '/']\r\ni = 0\r\nwhile True:\r\n    sys.stdout.write('\\r' + 'working on it...{}'.format(loading[i]))\r\n    sys.stdout.flush()\r\n    i = i + 1 if i < 3 else 0\r\n    time.sleep(1)\r\n```"}}
{"actor":{"display_login":"yuha0"}}