Beispiel #1
0
 def make_horses(weighted_powers):
     horses = []
     # Make 5 horses
     for h in range(1, 6):
         new_horse = Horse()  # Create a horse
         new_horse.power = weighted_powers[h - 1]  # Set its power
         new_horse.number = h  # Set its number
         horses.append(new_horse)  # Add to the track
     return horses
Beispiel #2
0
def load_sql(courses):
    for course in courses:

        c1 = Course(name=course.name, going=course.going)
        c1.save()

        for race in course.races:
            r1 = Race(
                    name=race.title, 
                    distance=convert_distance_to_yards(race.distance),
                    time=format_time(race.time),
                    runners=race.runners,
                    course=c1)
            r1.save()

            for horse in race.horses:
                h1 = Horse(
                        name=horse.name, 
                        race=r1,
                        weight=horse.weight,
                        last_ran=horse.last_ran,
                        forecast_odds=convert_to_decimal_odds(horse.forecast_odds))
                h1.save()