{"action":"created","issue":{"url":"https://api.github.com/repos/project-hatohol/hatohol/issues/1966","labels_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/1966/labels{/name}","comments_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/1966/comments","events_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/1966/events","html_url":"https://github.com/project-hatohol/hatohol/issues/1966","id":127825877,"number":1966,"title":"[hap2] zabbixapi.get_event_end_id()は文字列を返すほうがよいか？","user":{"login":"kz0817","id":2610513,"avatar_url":"https://avatars.githubusercontent.com/u/2610513?v=3","gravatar_id":"","url":"https://api.github.com/users/kz0817","html_url":"https://github.com/kz0817","followers_url":"https://api.github.com/users/kz0817/followers","following_url":"https://api.github.com/users/kz0817/following{/other_user}","gists_url":"https://api.github.com/users/kz0817/gists{/gist_id}","starred_url":"https://api.github.com/users/kz0817/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kz0817/subscriptions","organizations_url":"https://api.github.com/users/kz0817/orgs","repos_url":"https://api.github.com/users/kz0817/repos","events_url":"https://api.github.com/users/kz0817/events{/privacy}","received_events_url":"https://api.github.com/users/kz0817/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/project-hatohol/hatohol/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/project-hatohol/hatohol/labels/[Priority]%20Low","name":"[Priority] Low","color":"a0a0a0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/project-hatohol/hatohol/milestones/10","html_url":"https://github.com/project-hatohol/hatohol/milestones/16.04%20Stable%20release%20with%20the%20new%20UI","labels_url":"https://api.github.com/repos/project-hatohol/hatohol/milestones/10/labels","id":879245,"number":10,"title":"16.04 Stable release with the new UI","description":"Some improvements of WebUI.\r\nBug fixes.\r\n3/18 (Fri) 9:00 Feature freeze\r\n3/18 (Fri) Alpha\r\n3/25 (Fri) Beta 1\r\n4/1 (Fri) Beta 2\r\n4/8 (Fri) Beta 3\r\n4/15 (Fri) RC\r\n4/28 (Thu) Relase","creator":{"login":"kz0817","id":2610513,"avatar_url":"https://avatars.githubusercontent.com/u/2610513?v=3","gravatar_id":"","url":"https://api.github.com/users/kz0817","html_url":"https://github.com/kz0817","followers_url":"https://api.github.com/users/kz0817/followers","following_url":"https://api.github.com/users/kz0817/following{/other_user}","gists_url":"https://api.github.com/users/kz0817/gists{/gist_id}","starred_url":"https://api.github.com/users/kz0817/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kz0817/subscriptions","organizations_url":"https://api.github.com/users/kz0817/orgs","repos_url":"https://api.github.com/users/kz0817/repos","events_url":"https://api.github.com/users/kz0817/events{/privacy}","received_events_url":"https://api.github.com/users/kz0817/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":2,"state":"open","created_at":"2014-11-25T01:23:36Z","updated_at":"2016-01-21T01:39:08Z","due_on":"2016-04-27T15:00:00Z","closed_at":null},"comments":1,"created_at":"2016-01-21T01:39:08Z","updated_at":"2016-01-21T04:59:29Z","closed_at":null,"body":"get_event_end_id()は、取得した文字列を数値に変化して返す。\r\nこの関数の唯一のユーザーであるupdate_events_poll()は、その数値を再度文字列に変換しており、このシーケンスだけに着目すると無駄なことをしている。一見、数値でなく文字列を返したほうがよいようにも思うが、最終的な判断基準は、end idがなんなのか（それは数値なのか文字列なのか）を突き詰めて考えてそれにすればよいと思う。"},"comment":{"url":"https://api.github.com/repos/project-hatohol/hatohol/issues/comments/173451307","html_url":"https://github.com/project-hatohol/hatohol/issues/1966#issuecomment-173451307","issue_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/1966","id":173451307,"user":{"login":"Mnakagawa","id":7106792,"avatar_url":"https://avatars.githubusercontent.com/u/7106792?v=3","gravatar_id":"","url":"https://api.github.com/users/Mnakagawa","html_url":"https://github.com/Mnakagawa","followers_url":"https://api.github.com/users/Mnakagawa/followers","following_url":"https://api.github.com/users/Mnakagawa/following{/other_user}","gists_url":"https://api.github.com/users/Mnakagawa/gists{/gist_id}","starred_url":"https://api.github.com/users/Mnakagawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mnakagawa/subscriptions","organizations_url":"https://api.github.com/users/Mnakagawa/orgs","repos_url":"https://api.github.com/users/Mnakagawa/repos","events_url":"https://api.github.com/users/Mnakagawa/events{/privacy}","received_events_url":"https://api.github.com/users/Mnakagawa/received_events","type":"User","site_admin":false},"created_at":"2016-01-21T04:59:29Z","updated_at":"2016-01-21T04:59:29Z","body":"end idをlastInfoとして捉えるのであれば、文字列で返すべきです。\r\n文字列に変換している理由は、代入先がlastInfoだからです。\r\nしかし、その先の処理ではend idが数値としてwhileから抜けるための条件に利用されています。\r\n一つの関数内で、２つの意味で使用されているため、どちらがいいとは一概には言えないと思います。\r\nただ、処理が増えているのは間違いないので、処理を減らすためzabbixapi.get_event_end_idは\r\n文字列をそのまま返したほうがいいかもしれません。"}}