add main event and fix an issue w/ champ vs champ matches

This commit is contained in:
James Turk 2012-10-06 02:12:57 -04:00
parent da303edb04
commit 6676164462
3 changed files with 6 additions and 4 deletions

View File

@ -248,7 +248,7 @@ class Match(models.Model):
for star in title_teams[self.title_at_stake for star in title_teams[self.title_at_stake
].members.all(): ].members.all():
points[star.id] += 1 points[star.id] += 1
elif not battle_royal and len(title_teams) == 1: elif not battle_royal:
# look over titles in match, to score a title-nondefense # look over titles in match, to score a title-nondefense
for title, title_team in title_teams.iteritems(): for title, title_team in title_teams.iteritems():
# beat someone w/ title in a non-defense # beat someone w/ title in a non-defense
@ -311,7 +311,7 @@ class League(models.Model):
oldtimer_picks = models.IntegerField(default=2) oldtimer_picks = models.IntegerField(default=2)
def score_event(self, event): def score_event(self, event):
ppv_bonus = 1 if event.name.lower() not in ('raw', 'smackdown') else 0 ppv_bonus = 1 if event.name.lower() not in ('raw', 'smackdown', 'main event') else 0
TeamPoints.objects.filter(match__event=event).delete() TeamPoints.objects.filter(match__event=event).delete()
for match in event.matches.all(): for match in event.matches.all():
for star, points in match.points().iteritems(): for star, points in match.points().iteritems():

View File

@ -375,7 +375,9 @@ class LeagueTest(TestCase):
'password') 'password')
self.user2 = User.objects.create_user('me2', 'test@example.com', self.user2 = User.objects.create_user('me2', 'test@example.com',
'password') 'password')
self.league = League.objects.create(name='FOWL') self.league = League.objects.create(name='FOWL',
start_date='2010-01-01',
end_date='2013-01-01')
self.teddy = Team.objects.create(name='Team Teddy', login=self.user, self.teddy = Team.objects.create(name='Team Teddy', login=self.user,
league=self.league) league=self.league)
self.johnny = Team.objects.create(name='Team Johnny', login=self.user2, self.johnny = Team.objects.create(name='Team Johnny', login=self.user2,

View File

@ -110,7 +110,7 @@ def league(request, league_id):
'wwe': {'name': None, 'points': 0, 'date': None, 'wwe': {'name': None, 'points': 0, 'date': None,
'teams': {team: 0 for team in teams}}, 'teams': {team: 0 for team in teams}},
} }
belt_mapping = {'smackdown': 'ic', 'raw': 'us'} belt_mapping = {'smackdown': 'ic', 'raw': 'us', 'main event': 'ic'}
# go over all events in order to determine belt holders # go over all events in order to determine belt holders
for event in Event.objects.filter(date__gte=league.start_date, for event in Event.objects.filter(date__gte=league.start_date,