Package bosco :: Module run :: Class Run
[hide private]
[frames] | no frames]

Class Run

source code

           ??-32 --+    
                   |    
        base.MyStorm --+
                       |
ranking.RankableItem --+
                       |
                      Run

A run is directly connected to a single readout of an SI-Card. Competitors can have multiple runs during an event, but one run can not be associated to several SI-Card readouts. You have to create multiple runs in this case and an appropriate validator class which checks for the correct sequence of runs (e.g. for a relay).

Instance Methods [hide private]
 
__init__(self, card, course=None, punches=[], card_start_time=None, card_finish_time=None, check_time=None, clear_time=None, readout_time=None, store=None)
Creates a new Run object.
source code
 
__str__(self) source code
 
add_punch(self, punch, sequence_nr=None)
Adds a (stationnumber, punchtime) tuple to the run.
source code
 
add_punchlist(self, punchlist)
Adds a list of (stationnumber, punchtime) tupeles to the run.
source code
 
set_coursecode(self, code)
Sets the course for this run.
source code
(Punch, Control) tuples
punchlist(self, ignored=False)
Return all valid 'normal' punches ordered by punchtime
source code
 
check_sequence(self)
Check if punchtimes match punch sequence numbers.
source code
 
validate(self, validator_class=None, args=None)
Validate this run.
source code
 
score(self, scoreing_class=None, args=None)
Score this run.
source code

Inherited from base.MyStorm (private): _get_store, _set_store

Inherited from ranking.RankableItem: finish, start

Inherited from ranking.RankableItem (private): _get_complete

Class Variables [hide private]
  __storm_table__ = 'run'
  id = Int(primary= True)
  _sicard_id = Int(name= 'sicard')
  sicard = Reference(_sicard_id, 'SICard.id')
  _course_id = Int(name= 'course')
  course = Reference(_course_id, 'Course.id')
  complete = Bool()
  override = Int()
  card_start_time = DateTime()
  manual_start_time = DateTime()
  start_time = property(lambda obj: obj.manual_start_time or obj...
  card_finish_time = DateTime()
  manual_finish_time = DateTime()
  finish_time = property(lambda obj: obj.manual_finish_time or o...
  check_time = DateTime()
  clear_time = DateTime()
  readout_time = DateTime()
  punches = ReferenceSet(id, 'Punch._run_id')

Inherited from base.MyStorm (private): _store

Method Details [hide private]

__init__(self, card, course=None, punches=[], card_start_time=None, card_finish_time=None, check_time=None, clear_time=None, readout_time=None, store=None)
(Constructor)

source code 

Creates a new Run object.

Parameters:
  • card (Object of class SICard or card number as integer. If the card number is given the store parameter is mandatory.) - SICard
  • course (Object of class Course or course code as string.) - Course
  • punches (List of (stationcode, punchtime) tuples.) - Punches to add to the run.
  • card_start_time (datetime or None if unknown) - Time the SI-Card last punched a start control
  • card_finish_time (datetime or None if unknown) - Time the SI-Card last punched a finish control
  • check_time (datetime or None if unknown) - Time the SI-Card was checked
  • clear_time (datetime or None if unknown) - Time the SI-Card was cleared
  • readout_time (datetime or None if unknown) - Time the run was read from the SI-Card
  • store - Storm store for the objects referenced by this run. A store is needed if card or course are given as int/string or if punches is non empty.

__str__(self)
(Informal representation operator)

source code 
Overrides: ranking.RankableItem.__str__

set_coursecode(self, code)

source code 

Sets the course for this run.

Parameters:
  • coursecode (unicode or None) - The code of the course or None to clear the code.

punchlist(self, ignored=False)

source code 

Return all valid 'normal' punches ordered by punchtime

Parameters:
  • ignored - Return punches normally ignored
Returns: (Punch, Control) tuples

validate(self, validator_class=None, args=None)

source code 

Validate this run. Validation of runs is normally refered to the course, but passing a special validator class is supported.

Parameters:
  • validator_class - Class to use as a validation strategy. This must be a subclass of bosco.ranking.Validator
  • args (dict of keyword arguments) - Arguments to pass to the validation strategy.
Returns:
validation result from validation_class.validate(obj)

See Also: bosco.ranking.Validator for more information about validation strategies

score(self, scoreing_class=None, args=None)

source code 

Score this run. Scoreing of runs is normally refered to the course, but passing a special scoreing class is supported.

Parameters:
  • scoreing_class - Class to use a scoreing stratey. This must be a subclass of bosco.ranking.AbstracScoreing.
  • args (dict of keyword arguments)
Returns:
scoreing result from scoreing_class.score(obj)

See Also: bosco.ranking.AbstractScoreing for more information about scoreing strategies


Class Variable Details [hide private]

start_time

Value:
property(lambda obj: obj.manual_start_time or obj.card_start_time)

finish_time

Value:
property(lambda obj: obj.manual_finish_time or obj.card_finish_time)