Package bosco :: Module ranking :: Class RelayScoreing
[hide private]
[frames] | no frames]

Class RelayScoreing

source code

   object --+            
            |            
CachingObject --+        
                |        
 AbstractScoreing --+    
                    |    
   object --+       |    
            |       |    
CachingObject --+   |    
                |   |    
        Validator --+    
                    |    
AbstractRelayScoreing --+
                        |
                       RelayScoreing

Combined validator and scoreing class for relay teams. This class validates and scores teams in a classical relay with different legs and a fixed order of the legs. It supports optional legs with a default time if the leg is not run successfully or if a runner runs longer than the default time. It also supports multiple course variants for a leg.

Instance Methods [hide private]
 
__init__(self, legs, event, cache=None)
@param legs: list of dicts with the following keys: * 'variants': tuple of course codes that are valid variants for this leg.
source code
 
_runs(self, team)
Return a list of all completed runs for this team.
source code
 
validate(self, team)
Validates a relay team.
source code
 
score(self, team)
Score a relay team.
source code

Inherited from CachingObject (private): _from_cache, _to_cache

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from AbstractScoreing: information

Inherited from Validator: DID_NOT_FINISH, DID_NOT_START, DISQUALIFIED, MISSING_CONTROLS, NOT_COMPLETED, OK

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, legs, event, cache=None)
(Constructor)

source code 

@param legs: list of dicts with the following keys:
             * 'variants': tuple of course codes that are valid variants for this leg.
             * 'starttime': start time for all non replaced runners, type datetime
             * 'defaulttime': time scored if no runner of the team successfully
               completes this leg or if the runner on this legs needs more time than
               the defaulttime, type timedelta or None if there is no defaulttime
@type legs:  dict
@param event: Event object used to validate and score individual runs.
@type event:  instance of a class derived from Event

Parameters:
  • cache - scoreing cache
Overrides: object.__init__

_runs(self, team)

source code 

Return a list of all completed runs for this team. Ordered by leg. If there is no run for a leg the list contains None at this index. If there is more than one run for a leg the result is undefined.

Parameters:
  • team (instance of Team)
Returns:
dict with the following keys: * finish: finish time of the run * runner: runner id of the run * course: course of the run * validation: validation code * lkm: lkm run on this code * score: score of the run * expected_time: expected time of the run
Overrides: AbstractRelayScoreing._runs

validate(self, team)

source code 

Validates a relay team.

Overrides: Validator.validate

See Also: Validator

score(self, team)

source code 

Score a relay team.

Overrides: AbstractScoreing.score

See Also: AbstractScoreing