-
-
Notifications
You must be signed in to change notification settings - Fork 846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user-friendly data import function #24
Comments
One thing I noticed while working on this is that the model for Teams is very odd in terms of how it represents the team names, and all the flags with showing/hiding institution names and team numbers. This makes importing data very annoying, especially for smaller tournaments and tournaments where the team's institution is not very relevant. I would heavily prefer each team is represented/importable based on a name (a string which wouldn't have to be unique) and Institution. Adding on institutions/prefixes and team numbers can then be done through views/templates/utility functions without having to be represented in the model. This will also allow much more flexibility in customising how condensed these abbreviations and the like should be. |
There are a couple of ideas behind the current implementation:
But that said, the current implementation probably has something of a hangover from the original implementation, which allowed for no relationship between institution name and team name. Also, when I changed it, I wanted to allow for tournaments where teams were named not numbered (e.g. Thropy), or where institutions aren't as relevant, which possibly led to the proliferation of irritating flags. I'm a little confused about what you mean though. Is the idea to move the current team-name permutations functionality out of the models and into views? I'm down for that. We'd just need a way to distinguish between "Auckland Charmander" (institution code part of team name) and just "Charmander" from Auckland - but one could argue this is a property of the tournament, not the team. |
Yea, its a tricky design problem, both on the front end and backend. The current per-team toggle for "show institutional prefix" is good, meaning we can specify these things on a case by case basis. In my current branch I've added a short_name method that uses self.institution.code + name rather than long_name's self.institution.name + name. This is probably the best default in that it ensures uniqueness but is also compact. Note that I've also added institution columns to many of the results page's (ie speaker team standings), partly as a bit of extra information, and partly as a fallback for when team's aren't using institutional prefixes but institutions are still relevant (perhaps Thropy?). These columns can be globally toggled off in the Config page (ie for a club's internal competition). Keeping the naming functions in the model is probably fine for now. I forgot what the problem was for importing, possibly it was a result of using parts of the import script that were written before a model change. If you want to have a look my script is in debate/management/commands/import_tournament.py |
I can imagine it being an issue for imports, mainly because we'd have to educate users about how to configure the spreadsheet so that the system knows the difference. Like, we could include a boolean field or something in the spreadsheet, but it'd be annoying to have to get your head around. What does |
Yea, Team.name is redundant. I think it would be good to keep the methods as Team.short_name and Team.long_name if just to emphasise that there are two different styles of name that both are not canonical to the reference or initially-imported name. We could also add a global toggle for "show institutional shortcode" that could be overridden if each team's "show institution" is set, so that the setting wouldn't need to be in an imported spreadsheet. Smaller tournaments are the ones that probably need the setting to be done on a case-by-case basis, so the manual editing shouldn't be too troublesome. |
Okay, so so far we're at:
Remaining question: What do we want to do about the |
short_name is probably the better form to use? Although we might have to add a check into short_name to check if the Institution actually has a Institution.code value (its not a required field IIRC?) |
Oh, but
I think class Institution(models.Model):
tournament = models.ForeignKey(Tournament)
code = models.CharField(max_length=20)
name = models.CharField(max_length=100)
abbreviation = models.CharField(max_length=8, default="") |
|
How about Or we could make a rule that we don't rely on |
Isn't unicode a method that most models are meant to have? But yea, setting it to short_name seems best given that seems to be the most common visual representation in use On Thu, May 22, 2014 at 3:15 AM, Chuan-Zheng Lee notifications@github.com
|
Oh, I mean, we could say by convention that the |
Yea, the |
Obsoleted by #157 |
To set up a tournament without needing to write a Python script (which is the status quo).
Possible ways of doing this
The text was updated successfully, but these errors were encountered: