Commits

David Krauth committed 980af2f

Incremental update

  • Participants
  • Parent commits 3833497

Comments (0)

Files changed (3)

File management/commands/football_ops.py

     fix_games()
     reset_pick_results()
 
+
+#-------------------------------------------------------------------------------
+@register
+def nfl_standings(**options):
+    wk = options.get('week')
+    if wk:
+        week = football.GameWeek.objects.for_week(wk)
+    else:
+        week = football.GameWeek.objects.current_week()
+        
+    for place, pick in football.sorted_standings(
+        list(football.WeeklyPick.objects.select_related().filter(week=week))
+    ):
+        print '%2d %2d %2d %s' % (place, pick.correct, pick.points, pick.user)
+
+
 #===============================================================================
 class Command(BaseCommand):
     option_list = BaseCommand.option_list + (
-        make_option('--date', default='', dest='date',
-            help='define a relative date'),
+        make_option('--date', default='', dest='date', help='define a relative date'),
+        make_option('--week', default=0, type='int', dest='week', help='define a week'),
     )
     help = 'Operations: %s' % (sorted(op_functions.keys()), )
 
     #---------------------------------------------------------------------------
     @property
     def points_delta(self):
-        if self.week.points is None:
+        if self.week.points == 0:
             return 999
 
         return abs(self.points - self.week.points)

File test/test3.xml

+<?xml version="1.0" encoding="UTF-8"?>
+
+<ss>
+  <gms w="15" y="2012" t="R" gd="0" bph="24">
+    <g eid="2012121300" gsis="55712" d="Thu" t="8:20" q="F" h="PHI" hnn="eagles" hs="13" v="CIN" vnn="bengals" vs="34" rz="0" ga="" gt="REG"/>
+    <g eid="2012121601" gsis="55713" d="Sun" t="1:00" q="P" h="ATL" hnn="falcons" hs="0" v="NYG" vnn="giants" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121606" gsis="55714" d="Sun" t="1:00" q="P" h="BAL" hnn="ravens" hs="0" v="DEN" vnn="broncos" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121600" gsis="55715" d="Sun" t="1:00" q="P" h="CHI" hnn="bears" hs="0" v="GB" vnn="packers" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121604" gsis="55716" d="Sun" t="1:00" q="P" h="CLE" hnn="browns" hs="0" v="WAS" vnn="redskins" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121607" gsis="55717" d="Sun" t="1:00" q="P" h="HOU" hnn="texans" hs="0" v="IND" vnn="colts" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121605" gsis="55718" d="Sun" t="1:00" q="P" h="MIA" hnn="dolphins" hs="0" v="JAC" vnn="jaguars" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121602" gsis="55719" d="Sun" t="1:00" q="P" h="NO" hnn="saints" hs="0" v="TB" vnn="buccaneers" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121603" gsis="55720" d="Sun" t="1:00" q="P" h="STL" hnn="rams" hs="0" v="MIN" vnn="vikings" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121608" gsis="55721" d="Sun" t="4:05" q="P" h="ARI" hnn="cardinals" hs="0" v="DET" vnn="lions" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121610" gsis="55722" d="Sun" t="4:05" q="P" h="BUF" hnn="bills" hs="0" v="SEA" vnn="seahawks" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121609" gsis="55723" d="Sun" t="4:05" q="P" h="SD" hnn="chargers" hs="0" v="CAR" vnn="panthers" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121611" gsis="55724" d="Sun" t="4:25" q="P" h="DAL" hnn="cowboys" hs="0" v="PIT" vnn="steelers" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121612" gsis="55725" d="Sun" t="4:25" q="P" h="OAK" hnn="raiders" hs="0" v="KC" vnn="chiefs" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121613" gsis="55726" d="Sun" t="8:20" q="P" h="NE" hnn="patriots" hs="0" v="SF" vnn="49ers" vs="0" rz="0" ga="" gt="REG"/>
+    <g eid="2012121700" gsis="55727" d="Mon" t="8:30" q="P" h="TEN" hnn="titans" hs="0" v="NYJ" vnn="jets" vs="0" rz="0" ga="" gt="REG"/>
+  </gms>
+</ss>