{"action":"opened","issue":{"url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/1682","labels_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/1682/labels{/name}","comments_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/1682/comments","events_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/1682/events","html_url":"https://github.com/learning-unlimited/ESP-Website/issues/1682","id":72662500,"number":1682,"title":"Onsite grid's \"Print schedule\" button doesn't automatically check students in","user":{"login":"pteromys","id":380280,"avatar_url":"https://avatars.githubusercontent.com/u/380280?v=3","gravatar_id":"","url":"https://api.github.com/users/pteromys","html_url":"https://github.com/pteromys","followers_url":"https://api.github.com/users/pteromys/followers","following_url":"https://api.github.com/users/pteromys/following{/other_user}","gists_url":"https://api.github.com/users/pteromys/gists{/gist_id}","starred_url":"https://api.github.com/users/pteromys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pteromys/subscriptions","organizations_url":"https://api.github.com/users/pteromys/orgs","repos_url":"https://api.github.com/users/pteromys/repos","events_url":"https://api.github.com/users/pteromys/events{/privacy}","received_events_url":"https://api.github.com/users/pteromys/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-02T15:44:28Z","updated_at":"2015-05-02T15:44:28Z","closed_at":null,"body":"We could modify `OnSiteClassList.printschedule_status` to do it. If we do, we should probably change the text of the \"Print schedule\" button to say something like \"Check in student and print schedule\", just to be explicit about the side effect.\r\n\r\nToday, UChicago is using the script below to check in everyone who appears on the printer queue.\r\n\r\n(The solution may share some functionality with `OnSiteCheckinModule.rapidcheckin` and/or `StudentRegCore.students`, so it might be worth factoring out any common code into a controller.)\r\n\r\n```py\r\nimport time\r\nfrom datetime import datetime\r\nfrom esp.utils.models import PrintRequest\r\nfrom esp.program.models import Program, ESPUser, Record\r\n\r\nTODAY=datetime(2015, 05, 02)\r\nPROGRAM=Program.by_prog_inst('Splash', '2015_Spring2')\r\n\r\nwhile True:\r\n    time.sleep(1)\r\n    for x in PrintRequest.objects.order_by('time_requested').filter(time_requested__gte=TODAY).values_list('user_id', flat=True):\r\n        record, created = Record.objects.get_or_create(user_id=x, event='attended', program=PROGRAM)\r\n        if created:\r\n            print '%s checked in' % ESPUser.objects.get(id=x).username\r\n```"}}