Package bosco :: Module course :: Class Course
[hide private]
[frames] | no frames]

Class Course

source code

           ??-32 --+    
                   |    
        base.MyStorm --+
                       |
      object --+       |
               |       |
ranking.Rankable --+   |
                   |   |
          BaseCourse --+
                       |
                      Course

Base class for all kinds of courses. Special kinds of courses should be derived from this class. Derived class must at least override the append or validate methods. This class implements an unordered set of controls as a course without any validation.

The distance and altitude attributes are in meters and may be None.

Instance Methods [hide private]
 
__init__(self, code, length=None, climb=None, validator=None, scoreing=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__max_index(self) source code
 
__has_index(self, index) source code
 
append(self, control, length=None, climb=None)
Append a single control to the course.
source code
 
insert(self, control, index, length=None, climb=None)
Insert an additional control into the course at an arbitrary postition.
source code
 
extend(self, control_list)
Extend the course with the controls from control_list.
source code
 
lkm(self)
Returns: 'Leistungskilometer': length/1000.0+climb/100.0
source code
 
expected_time(self, speed)
Returns the expected time for this course.
source code
 
controlcount(self) source code
 
controllist(self)
@return list of controls in this course with sistations that are not overriden.
source code
 
validate(self, run)
Validate a run according to this course.
source code
 
score(self, run)
Score a run according to this course.
source code
 
__str__(self)
str(x)
source code
 
__unicode__(self) source code

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

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

Class Variables [hide private]
  __storm_table__ = 'course'
  id = Int(primary= True)
  code = Unicode()
  length = Int()
  climb = Int()
  members = ReferenceSet(id, 'Run._course_id')
  controls = ReferenceSet(id, ControlSequence._course_id, Contro...
  sequence = ReferenceSet(id, 'ControlSequence._course_id', orde...

Inherited from base.MyStorm (private): _store

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, code, length=None, climb=None, validator=None, scoreing=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • code (unicode) - Descriptive code for this course. Usually 3 characters long. For 'normal' events this corresponds to the category name.
  • length (int) - Length of the course in meters
  • climb (int) - Altitude differences in meters
Overrides: object.__init__

append(self, control, length=None, climb=None)

source code 

Append a single control to the course.

Parameters:
  • control (Control object or unicode) - next control. The control is automatically created if it does not yet exist.

lkm(self)

source code 
Returns:
'Leistungskilometer': length/1000.0+climb/100.0

expected_time(self, speed)

source code 

Returns the expected time for this course.

Parameters:
  • speed - expected speed in minutes per kilometer

validate(self, run)

source code 

Validate a run according to this course.

Parameters:
  • run - Run to be validated.
Returns:
Validation status

See Also: bosco.ranking.Validator

score(self, run)

source code 

Score a run according to this course.

Parameters:
  • run - Run to be scored.
Returns:
Scoreing result

See Also: bosco.ranking.AbstractScoreing

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Class Variable Details [hide private]

controls

Value:
ReferenceSet(id, ControlSequence._course_id, ControlSequence._control_\
id, Control.id, order_by= ControlSequence.sequence_number)

sequence

Value:
ReferenceSet(id, 'ControlSequence._course_id', order_by= ControlSequen\
ce.sequence_number)