Пример #1
0
def add_jam(eventbrite_id, jam_name, date): # Add a new Jam, plus a series of placeholder default hidden workshops (parking, front desk and break time)
    jam = RaspberryJam(jam_id=eventbrite_id, name=jam_name, date=date) # Add the Jam row
    db_session.add(jam)
    db_session.commit()
    if configuration.verify_config_item_bool("general", "new_jam_add_default_events"):
        car_parking_workshop = db_session.query(Workshop).filter(Workshop.workshop_title == "Car Parking").first()
        car_parking_room = db_session.query(WorkshopRoom).filter(WorkshopRoom.room_name == "Car Park").first()
        car_parking = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=car_parking_workshop.workshop_id, workshop_room_id=car_parking_room.room_id, slot_id=0, pilot=0)
        db_session.add(car_parking) # Add car parking into slot 0

        front_desk_workshop = db_session.query(Workshop).filter(Workshop.workshop_title == "Front desk").first()
        front_desk_registration_room = db_session.query(WorkshopRoom).filter(WorkshopRoom.room_name == "Front Desk Registration").first()
        front_desk_room = db_session.query(WorkshopRoom).filter(WorkshopRoom.room_name == "Front Desk General").first()
        front_desk = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=front_desk_workshop.workshop_id, workshop_room_id=front_desk_registration_room.room_id, slot_id=0, pilot=0)

        db_session.add(front_desk) # Add front desk registration

        front_desk = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=front_desk_workshop.workshop_id, workshop_room_id=front_desk_room.room_id, slot_id=1, pilot=0)
        db_session.add(front_desk)
        front_desk = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=front_desk_workshop.workshop_id, workshop_room_id=front_desk_room.room_id, slot_id=2, pilot=0)
        db_session.add(front_desk)
        front_desk = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=front_desk_workshop.workshop_id, workshop_room_id=front_desk_room.room_id, slot_id=3, pilot=0)
        db_session.add(front_desk)
        front_desk = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=front_desk_workshop.workshop_id, workshop_room_id=front_desk_room.room_id, slot_id=4, pilot=0)
        db_session.add(front_desk) # Add 4th normal front desk


        break_room = db_session.query(WorkshopRoom).filter(WorkshopRoom.room_name == "Foyer (ground floor)").first()
        break_workshop = db_session.query(Workshop).filter(Workshop.workshop_title == "Break time").first()
        break_time = RaspberryJamWorkshop(jam_id=jam.jam_id, workshop_id=break_workshop.workshop_id, workshop_room_id=break_room.room_id, slot_id=3, pilot=0)
        db_session.add(break_time) # Add break time into break session


        db_session.commit()
Пример #2
0
def index():
    if not configuration.verify_config_item_bool("modules", "module_core"):
        return "Core module not enabled. Enable it by adding under the [modules] section in {}, module_core = true.".format(
            configuration.config_file_location)
    cookie = request.cookies.get('jam_order_id')
    if cookie and len(cookie) == 9 and database.verify_attendee_id(
            cookie, database.get_current_jam_id()):
        return redirect("workshops")
    form = forms.GetOrderIDForm(request.form)
    if request.method == 'POST' and form.validate():
        if database.verify_attendee_id(
                form.order_id.data, database.get_current_jam_id(
                )) and form.day_password.data == day_password:
            resp = make_response(redirect("workshops"))
            resp.set_cookie('jam_order_id',
                            str(form.order_id.data),
                            expires=(datetime.now() + timedelta(hours=6)))
            resp.set_cookie('jam_id', str(database.get_current_jam_id()))
            return resp
        else:
            flash(
                "Error, no order with that ID found or Jam password is wrong. Please try again.",
                "danger")
            return render_template('index.html', form=form)
    return render_template('index.html', form=form)
Пример #3
0
 def decorated_function():
     for module_name in modules:
         if not configuration.verify_config_item_bool(
                 "modules", module_name):
             flash(
                 "Module {} is not enabled and required for this page.".
                 format(module_name), "danger")
             return redirect("404")
     return f(*args, **kwargs)