Beispiel #1
0
def edit_booking(id):
    booking = booking_repository.select(id)
    workouts = workout_repository.select_all()
    members = member_repository.select_all()
    return render_template("/bookings/edit.html",
                           booking=booking,
                           workouts=workouts,
                           members=members)
def edit_booking(id):
    booking = booking_repository.select(id)
    members = member_repository.select_all()
    activities = activity_repository.select_all()
    return render_template("bookings/edit.html",
                           booking=booking,
                           members=members,
                           activities=activities)
Beispiel #3
0
def remove_booking(id):
    # Select workout from booking
    booking = booking_repository.select(id)
    workout_id = booking.workout.id
    workout = workout_repository.select(workout_id)
    # Delete booking
    booking_repository.delete(id)
    # Decrease booked in workout and updte db
    workout.decrease_booked()
    workout_repository.update(workout)
    # Flash success message
    flash(f"Removed {booking.member.first_name} from {booking.workout.name}!", "success")
    # Redirect
    return redirect('/bookings')
def delete_booking(id):
    booking = booking_repository.select(id)
    fitness_class_id = booking.fitness_class.id
    fitness_class = fitness_class_repository.select(booking.fitness_class.id)
    class_type = fitness_class.class_type
    date = fitness_class.date
    time = fitness_class.time
    duration = fitness_class.duration
    instructor = fitness_class.instructor
    location = fitness_class.location
    capacity = fitness_class.capacity + 1

    fitness_class = FitnessClass(class_type, date, time, duration, instructor,
                                 capacity, location, fitness_class_id)
    fitness_class_repository.edit(fitness_class)

    booking_repository.delete(id)
    return redirect('/bookings')
def show(id):
    booking = booking_repository.select(id)
    return render_template("bookings/show.html", booking=booking)
Beispiel #6
0
def show(id):
    booking = booking_repository.select(id)
    #lessons = member_repository.lessons(member)
    return render_template("bookings/show.html", booking=booking)
def delete_booking(id):
    yogaclass_id = booking_repository.select(id).yogaclass.id
    booking_repository.delete(id)
    return redirect(f'/yogaclasses/{yogaclass_id}')