Commits

David Krauth  committed 0ef2b90

Incremental update

  • Participants
  • Parent commits e80dde4

Comments (0)

Files changed (5)

     #---------------------------------------------------------------------------
     @property
     def has_started(self):
-        return self.kickoff >= datetime_now()
+        return datetime_now() >= self.kickoff
         
     #---------------------------------------------------------------------------
     @property

File templates/nfl/results/week.html

     {% endif %} {% endwith %}
     
     <table class="results-table">
-    {% if week.has_started %}
+    {% if not week.has_started %}
         <thead>
             <tr>
                 <th>Player</th>

File utils/ncaa_results.py

 final_re = re.compile(r'^Final(?:/OT)?$', re.M)
 
 #-------------------------------------------------------------------------------
+def parse_score(score):
+    score = score.split()
+    if len(score) == 2:
+        return int(score[1])
+
+    return int(score[0][-1] if len(score[0]) < 7 else score[0][-2:])
+    
+#-------------------------------------------------------------------------------
 def parse_results(text):
     results = []
+    mapping = {}
     for block in final_re.split(text):
         if not block:
             continue
         
-        block = block.splitlines()
-        away, home = block[2].strip('1234567890'), block[5].strip('1234567890')
-        scores = [block[4].split(), block[7].split()]
-        for i in (0,1):
-            score = scores[i]
-            if len(score) == 2:
-                score = score[1]
-            else:
-                score = score[0][-1] if len(score[0]) < 7 else score[0][-2:]
-            
-            scores[i] = int(score)
-    
-        results.append((away, home, scores[1] > scores[0], scores))
+        block  = block.splitlines()
+        away   = block[2].strip('1234567890')
+        ascore = parse_score(block[4])
+        home   = block[5].strip('1234567890')
+        hscore = parse_score(block[7])
 
-    return results
+        results.append((away, ascore, home, hscore))
+        mapping[away] = ascore > hscore
+        mapping[home] = hscore > ascore
+
+    return results, mapping
 
 ################################################################################
 if __name__ == '__main__':

File utils/results.txt

-Final
-1234 T
-BYU
-(2-2, 0-2 away)
-0006 6
-24Boise St
-(2-1, 2-0 home)
-0070 7
-Defense rules as No. 24 Boise St. edges BYU
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Saturday, September 22 2012
-Final
-1234 T
-Kentucky
-(1-3, 0-1 SEC)
-0000 0
-14Florida
-(4-0, 3-0 SEC)
-32177 38
-Watch Replay 
-Florida cruises to 26th straight win vs. Kentucky
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Florida Atl
-(1-3, 0-1 Sun Belt)
-0007 7
-1Alabama
-(4-0, 1-0 SEC)
-141637 40
-Watch Replay 
-Top-ranked Alabama smothers Florida Atlantic
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-2LSU
-(4-0, 1-0 SEC)
-9030 12
-Auburn
-(1-3, 0-2 SEC)
-7300 10
-Defense leads LSU to victory against Auburn
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-22Arizona
-(3-1, 0-1 Pac-12)
-0000 0
-3Oregon
-(4-0, 1-0 Pac-12)
-761521 49
-Mariota, No. 3 Oregon blow out No. 22 Arizona
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-10Clemson
-(3-1, 0-1 ACC)
-147106 37
-4Florida St
-(4-0, 2-0 ACC)
-772114 49
-FSU scores 35 in 2nd half, tops Clemson
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Vanderbilt
-(1-3, 0-2 SEC)
-0300 3
-5Georgia
-(4-0, 2-0 SEC)
-1314210 48
-Murray, Georgia ride fast start to rout of Vandy
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-15Kansas St
-(4-0, 1-0 Big 12)
-010014 24
-6Oklahoma
-(2-1, 0-1 Big 12)
-3376 19
-Kansas St. upsets Sooners to avenge blowout
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Missouri
-(2-2, 0-2 SEC)
-0307 10
-7South Carolina
-(4-0, 2-0 SEC)
-02173 31
-Shaw picks apart Mizzou, leads South Carolina
-Box Score »  Drive Chart »  Play-By-Play »  Conversation » 
-+
-Final
-1234 T
-Maryland
-(2-2, 1-1 away)
-7707 21
-8West Virginia
-(3-0, 3-0 home)
-141007 31
-Smith, Austin team as W. Va. outlasts Maryland
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-18Michigan
-(2-2, 0-2 away)
-0006 6
-11Notre Dame
-(4-0, 2-0 home)
-01003 13
-Te'o, defense key Irish victory over Wolverines
-Box Score »  Drive Chart »  Play-By-Play »  Conversation » 
-+
-Final
-1234 T
-California
-(1-3, 0-1 Pac-12)
-0360 9
-13USC
-(3-1, 1-1 Pac-12)
-710010 27
-USC bounces back with victory against Cal
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-UAB
-(0-3, 0-2 away)
-6603 15
-16Ohio St
-(4-0, 4-0 home)
-02108 29
-Miller, Ohio State overcome slow start, top UAB
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Virginia
-(2-2, 0-1 ACC)
-0007 7
-17TCU
-(3-0, 1-0 Big 12)
-7767 27
-TCU tops Virginia, wins FBS-best 11th straight
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Oregon St
-(2-0, 1-0 Pac-12)
-31473 27
-19UCLA
-(3-1, 0-1 Pac-12)
-010010 20
-Oregon State clamps down, upsets No. 19 UCLA
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-20Louisville
-(4-0, 1-0 away)
-7777 28
-Florida Int
-(1-3, 1-1 home)
-7707 21
-Watch Replay 
-Bridgewater powers No. 20 Louisville past FIU
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-E Michigan
-(0-4, 0-1 MAC)
-0700 7
-21Michigan St
-(3-1, 2-1 home)
-03614 23
-Bell-led Michigan St. escapes Eastern Michigan
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-South Alabama
-(1-3, 0-2 away)
-0037 10
-23Miss. St
-(4-0, 1-0 SEC)
-02073 30
-Watch Replay 
-Sluggish Mississippi St. downs South Alabama
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+
-Final
-1234 T
-Idaho St
-(1-2, 0-2 away)
-0007 7
-25Nebraska
-(3-1, 3-0 home)
-3510217 73
-Burkhead, Nebraska easily dispatch Idaho St.
-Box Score »  Drive Chart »  Play-By-Play »  Conversation »   Highlights  » 
-+

File views/nfl_views.py

             args=(football.NFL_CURRENT_SEASON,)
         )
 
-    if week.in_progress:
+    if week.has_started:
         week.update_results()
     
     if SMACK_TALK_ENABLED: