Пример #1
0
def create_class_type():
    name = request.form['name']
    description = request.form['description']
    intensity = request.form['intensity']
    difficulty = request.form['difficulty']

    new_class_type = ClassType(name, description, intensity, difficulty)
    class_type_repository.add(new_class_type)
    return redirect('/class-types')
Пример #2
0
 def setUp(self):
     self.class_type = self.body_pump = ClassType(
         "Body Pump",
         "Barbell workout to music. Great for building strength and lean muscle!",
         "High", "Moderate")
     self.body_pump_express = FitnessClass(self.class_type, "03/12/2020",
                                           "14:00", "30 minutes",
                                           "Charlotte Anderson", 20,
                                           "Studio 1")
Пример #3
0
def update_class_type_details(id):
    name = request.form['name']
    description = request.form['description']
    intensity = request.form['intensity']
    difficulty = request.form['difficulty']

    updated_class_type = ClassType(name, description, intensity, difficulty,
                                   id)
    class_type_repository.edit(updated_class_type)
    return redirect('/class-types')
Пример #4
0
def select(id):
    class_type = None
    sql = "SELECT * from class_types WHERE id = %s"
    value = [id]
    result = run_sql(sql, value)[0]

    if result is not None:
        class_type = ClassType(result['name'], result['description'],
                               result['intensity'], result['difficulty'],
                               result['id'])
    return class_type
Пример #5
0
def select_all():
    all_class_types = []
    sql = "SELECT * FROM class_types"
    results = run_sql(sql)

    for row in results:
        class_type = ClassType(row['name'], row['description'],
                               row['intensity'], row['difficulty'], row['id'])
        all_class_types.append(class_type)

    return all_class_types
Пример #6
0
 def setUp(self):
     self.class_type = self.body_pump = ClassType(
         "Body Pump",
         "Barbell workout to music. Great for building strength and lean muscle!",
         "High", "Moderate")
     self.body_pump_express = FitnessClass(self.class_type, "03/12/2020",
                                           "14:00", "30 minutes",
                                           "Charlotte Anderson", 20,
                                           "Studio 1")
     self.claire = Member("Claire Whittaker", "10 Smith Street",
                          "07783902109", "*****@*****.**", True, 1004)
     self.booking = Booking(self.claire, self.body_pump_express)
Пример #7
0
member_repository.delete_all()

claire = Member("Claire Whittaker", "10 Smith Street", "07783902109",
                "*****@*****.**", True, 1004)
member_repository.add(claire)

angela = Member("Angela O'Shaughnessy", "12 Smith Street", "07785976809",
                "*****@*****.**", False, 895)
member_repository.add(angela)

angela2 = Member("Angela O'Shaughnessy", "18 Laurel Terrace", "07788976224",
                 "*****@*****.**", False, 834)
member_repository.add(angela2)

body_pump = ClassType(
    "Body Pump", "Barbell workout to music. Great for building lean muscle!",
    "High", "Moderate")
class_type_repository.add(body_pump)

body_balance = ClassType(
    "Body Balance", "A mix of yoga, tai chi and pilates. Great for mobility",
    "Low", "Low")
class_type_repository.add(body_balance)

spin = ClassType(
    "Spin",
    "Calorie-burning workout to music on an exercise bike. Gets your heart rate up!",
    "High", "Medium")
class_type_repository.add(spin)

body_pump_express = FitnessClass(body_pump, "03/12/2020", "14:00", 30,
Пример #8
0
 def setUp(self):
     self.body_pump = ClassType("Body Pump", "Barbell workout to music. Great for building strength and lean muscle!", "High", "Moderate")