{"action":"opened","issue":{"url":"https://api.github.com/repos/anuko/timetracker/issues/35","repository_url":"https://api.github.com/repos/anuko/timetracker","labels_url":"https://api.github.com/repos/anuko/timetracker/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/anuko/timetracker/issues/35/comments","events_url":"https://api.github.com/repos/anuko/timetracker/issues/35/events","html_url":"https://github.com/anuko/timetracker/issues/35","id":246707310,"number":35,"title":"cron.php fetching wrong table ID","user":{"login":"mrbaozi","id":1576526,"avatar_url":"https://avatars1.githubusercontent.com/u/1576526?v=4","gravatar_id":"","url":"https://api.github.com/users/mrbaozi","html_url":"https://github.com/mrbaozi","followers_url":"https://api.github.com/users/mrbaozi/followers","following_url":"https://api.github.com/users/mrbaozi/following{/other_user}","gists_url":"https://api.github.com/users/mrbaozi/gists{/gist_id}","starred_url":"https://api.github.com/users/mrbaozi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrbaozi/subscriptions","organizations_url":"https://api.github.com/users/mrbaozi/orgs","repos_url":"https://api.github.com/users/mrbaozi/repos","events_url":"https://api.github.com/users/mrbaozi/events{/privacy}","received_events_url":"https://api.github.com/users/mrbaozi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-31T10:08:39Z","updated_at":"2017-07-31T10:08:39Z","closed_at":null,"body":"Hi, first of all thanks so much for making this tool :)\r\n\r\n**System:**\r\nmysql  Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using  EditLine wrapper\r\nPHP 7.0.18-0ubuntu0.16.04.1\r\n\r\n**Issue:**\r\nIn cron.php, line 50:\r\n```\r\n $sql = \"select * from tt_cron c\r\n   left join tt_fav_reports fr on (c.report_id = fr.id)\r\n   where $now >= c.next and fr.status = 1\r\n   and c.status = 1 and c.report_id is not null and c.email is not null\";\r\n```\r\nThis code replaces the tt_cron.id with tt_fav_reports.id, which leads to line 94 not updating the correct entry for $next:\r\n```\r\n  $sql = \"update tt_cron set last = $now, next = $next where id = \".$val['id'];\r\n```\r\nA quick fix that I've tested is replacing line 50 with the following:\r\n```\r\n $sql = \"select * from tt_fav_reports fr\r\n   left join tt_cron c on (c.report_id = fr.id)\r\n   where $now >= c.next and fr.status = 1\r\n   and c.status = 1 and c.report_id is not null and c.email is not null\";\r\n```\r\nThis keeps all columns but uses tt_cron.id instead of tt_fav_reports.id.\r\nIf you'd like I can open a PR."}}
{"actor":{"display_login":"mrbaozi"}}