Created
November 11, 2013 17:56
-
-
Save GHowlett/7417367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the competitor is the atomic entity of a tournament | |
var Competitor = Backbone.Model.extend({ | |
defaults: { | |
firstname: "Bye", | |
lastname: "", | |
team: "None", | |
id: Math.floor(Math.random() * 10000) | |
} | |
}) | |
// A match is a pair of teams or individuals (depending on the sport) | |
// it also has an estimated start time, which is updated by its parent location as it's approached | |
// the result is set after the match has ended and used as a record by its parent bracket | |
// the bout is the match id | |
var Match = Backbone.Model.extend({ | |
defaults: { | |
homeID: null, | |
awayID: null, | |
time: "No Estimate", | |
result: "None Yet", | |
bout: Math.floor(Math.random() * 10000) | |
} | |
}) | |
// A location is a queue of matches that are coming up soon | |
// Identifiers vary with sport (eg. court 1, mat 4, field 2) | |
var Location = Backbone.Collection.extend({ | |
model: Match, | |
identifier: "None" | |
}) | |
// A single node for a tree of linked match nodes (referenced by bout#) | |
// the winners of two seed bouts form a new match called 'matchup' | |
var BracketNode = Backbone.Model.extend({ | |
defaults: { | |
seedBout1: null, | |
seedBout2: null, | |
matchup: null | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment