{"action":"created","issue":{"url":"https://api.github.com/repos/czlee/tabbycat/issues/365","repository_url":"https://api.github.com/repos/czlee/tabbycat","labels_url":"https://api.github.com/repos/czlee/tabbycat/issues/365/labels{/name}","comments_url":"https://api.github.com/repos/czlee/tabbycat/issues/365/comments","events_url":"https://api.github.com/repos/czlee/tabbycat/issues/365/events","html_url":"https://github.com/czlee/tabbycat/issues/365","id":170588779,"number":365,"title":"Investigate having useful defaults for general break categories","user":{"login":"czlee","id":1725499,"avatar_url":"https://avatars.githubusercontent.com/u/1725499?v=3","gravatar_id":"","url":"https://api.github.com/users/czlee","html_url":"https://github.com/czlee","followers_url":"https://api.github.com/users/czlee/followers","following_url":"https://api.github.com/users/czlee/following{/other_user}","gists_url":"https://api.github.com/users/czlee/gists{/gist_id}","starred_url":"https://api.github.com/users/czlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czlee/subscriptions","organizations_url":"https://api.github.com/users/czlee/orgs","repos_url":"https://api.github.com/users/czlee/repos","events_url":"https://api.github.com/users/czlee/events{/privacy}","received_events_url":"https://api.github.com/users/czlee/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/czlee/tabbycat/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/czlee/tabbycat/labels/low-priority","name":"low-priority","color":"cccccc"}],"state":"open","locked":false,"assignee":{"login":"czlee","id":1725499,"avatar_url":"https://avatars.githubusercontent.com/u/1725499?v=3","gravatar_id":"","url":"https://api.github.com/users/czlee","html_url":"https://github.com/czlee","followers_url":"https://api.github.com/users/czlee/followers","following_url":"https://api.github.com/users/czlee/following{/other_user}","gists_url":"https://api.github.com/users/czlee/gists{/gist_id}","starred_url":"https://api.github.com/users/czlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czlee/subscriptions","organizations_url":"https://api.github.com/users/czlee/orgs","repos_url":"https://api.github.com/users/czlee/repos","events_url":"https://api.github.com/users/czlee/events{/privacy}","received_events_url":"https://api.github.com/users/czlee/received_events","type":"User","site_admin":false},"assignees":[{"login":"czlee","id":1725499,"avatar_url":"https://avatars.githubusercontent.com/u/1725499?v=3","gravatar_id":"","url":"https://api.github.com/users/czlee","html_url":"https://github.com/czlee","followers_url":"https://api.github.com/users/czlee/followers","following_url":"https://api.github.com/users/czlee/following{/other_user}","gists_url":"https://api.github.com/users/czlee/gists{/gist_id}","starred_url":"https://api.github.com/users/czlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czlee/subscriptions","organizations_url":"https://api.github.com/users/czlee/orgs","repos_url":"https://api.github.com/users/czlee/repos","events_url":"https://api.github.com/users/czlee/events{/privacy}","received_events_url":"https://api.github.com/users/czlee/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-08-11T07:52:26Z","updated_at":"2016-09-05T06:06:16Z","closed_at":null,"body":"Ideally both of the following would happen:\r\n\r\n1. When a team gets created, its break categories should default to all break categories in the tournament with `is_general=True`.\r\n\r\n2. When a break category gets created, if `is_general=True` then all teams in the tournament should be marked eligible for that category.\r\n\r\nThis might take some digging to find the correct way to implement this."},"comment":{"url":"https://api.github.com/repos/czlee/tabbycat/issues/comments/244665199","html_url":"https://github.com/czlee/tabbycat/issues/365#issuecomment-244665199","issue_url":"https://api.github.com/repos/czlee/tabbycat/issues/365","id":244665199,"user":{"login":"czlee","id":1725499,"avatar_url":"https://avatars.githubusercontent.com/u/1725499?v=3","gravatar_id":"","url":"https://api.github.com/users/czlee","html_url":"https://github.com/czlee","followers_url":"https://api.github.com/users/czlee/followers","following_url":"https://api.github.com/users/czlee/following{/other_user}","gists_url":"https://api.github.com/users/czlee/gists{/gist_id}","starred_url":"https://api.github.com/users/czlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czlee/subscriptions","organizations_url":"https://api.github.com/users/czlee/orgs","repos_url":"https://api.github.com/users/czlee/repos","events_url":"https://api.github.com/users/czlee/events{/privacy}","received_events_url":"https://api.github.com/users/czlee/received_events","type":"User","site_admin":false},"created_at":"2016-09-05T06:06:16Z","updated_at":"2016-09-05T06:06:16Z","body":"The problem with (1) is that you can't just rely on save signals—it needs to be a default in the proper sense, as in, the appropriate categories are pre-highlighted when you \"add\" a team in the Edit Database interface. We can't just overwrite the categories, or even detect if none are selected, because then there would be no way for the user to specify when creating (or saving) a team that the team should be eligible for no break categories. So we really need a dynamic default.\r\n\r\nDjango allows you to make the default for a model field a callable. But the callable has to take no arguments, which is problematic for our case because the default needs to be break categories _in the same tournament_, and a no-argument callable has no way of establishing _which_ tournament it cares about. So yeah, not great, I guess.\r\n\r\nAs for (2), we could detect in `BreakCategory.save()` if `self.pk is None` and then add all teams if it is and `self.is_general` is true, but I'm a little reluctant to—it seems to me that this breaks encapsulation (as a principle), and risks unfortunate side effects later down the line."}}
{"actor":{"display_login":"czlee"}}