def run(self): roles_list = [ "Herald", "Stage: Audio/Visual", "Stage: Camera Operator", "Stage: Vision Mixer", ] venue_list = ["Stage A", "Stage B", "Stage C"] for role_name in roles_list: role = Role.get_by_name(role_name) if role.shifts: for shift in role.shifts: p = shift.proposal app.logger.info('Updating shift') shift.start = get_start_time(p) shift.stop = get_end_time(p) shift.venue = VolunteerVenue.get_by_name(p.scheduled_venue.name) else: for venue_name in venue_list: venue = VolunteerVenue.get_by_name(venue_name) events = Proposal.query.join(Venue, Proposal.scheduled_venue_id == Venue.id)\ .filter(Venue.name == venue.name, Proposal.state == 'finished')\ .all() for e in events: start = get_start_time(e) stop = get_end_time(e) to_add = Shift(role=role, venue=venue, start=start, end=stop, min_needed=1, max_needed=1, proposal=e) db.session.add(to_add) db.session.commit()
def create_new_from_form(form): venue = VolunteerVenue(name=form.name.data, mapref=form.mapref.data) db.session.add(venue) db.session.commit() app.logger.info('%s created a new venue, %s (id: %s)', current_user.id, venue.name, venue.id) return venue
def validate_name(form, field): venue = VolunteerVenue.get_by_name(field.data) if form.id.data == 0 and venue is not None: raise ValidationError('That venue already exists') elif venue is not None and form.id.data != venue.id: raise ValidationError('A venue with that name already exists')
def run(self): venue_list = [ {"name": "Badge Tent", "mapref": "https://map.emfcamp.org/#20.24/52.0405486/-2.3781891"}, {"name": "Bar 2", "mapref": "https://map.emfcamp.org/#19/52.0409755/-2.3786306"}, {"name": "Bar", "mapref": "https://map.emfcamp.org/#19/52.0420157/-2.3770749"}, {"name": "Car Park", "mapref": "https://map.emfcamp.org/#19.19/52.0389412/-2.3783488"}, {"name": "Entrance", "mapref": "https://map.emfcamp.org/#18/52.039226/-2.378184"}, {"name": "Green Room", "mapref": "https://map.emfcamp.org/#20.72/52.0414959/-2.378016"}, {"name": "Info Desk", "mapref": "https://map.emfcamp.org/#21.49/52.0415113/-2.3776567"}, {"name": "Stage A", "mapref": "https://map.emfcamp.org/#17/52.039601/-2.377759"}, {"name": "Stage B", "mapref": "https://map.emfcamp.org/#17/52.041798/-2.376412"}, {"name": "Stage C", "mapref": "https://map.emfcamp.org/#17/52.040482/-2.377432"}, {"name": "Volunteer Tent", "mapref": "https://map.emfcamp.org/#20.82/52.0397817/-2.3767928"}, {"name": "Youth Workshop", "mapref": "https://map.emfcamp.org/#19.46/52.0420979/-2.3753702"}, {"name": "N/A", "mapref": "https://map.emfcamp.org/#16/52.0411/-2.3784"} ] # DO not change these names (each keys a description in apps/volunteer/role_descriptions/) role_list = [ # Stage stuff {"name": "Herald", "description": "Introduce talks and manage speakers at stage."}, {"name": "Stage: Audio/Visual", "description": "Run the audio for a stage. Make sure mics are working and that presentations work."}, {"name": "Stage: Camera Operator", "description": "Point, focus and expose the camera, then lock off shot and monitor it."}, {"name": "Stage: Vision Mixer", "description": "Vision mix the output to screen and to stream."}, # "Tent" roles {"name": "Badge Helper", "description": "Fix, replace and troubleshoot badges and their software."}, {"name": "Car Parking", "description": "Help park cars and get people on/off site."}, {"name": "Catering", "description": "Help our excellent catering team provide food for all the volunteers."}, {"name": "Entrance Steward", "description": "Greet people, check their tickets and help them get on site."}, {"name": "Games Master", "description": "Running Indie Games on the big screen in Stage A, and optionally Board Games."}, {"name": "Green Room", "description": "Make sure speakers get where they need to be with what they need."}, {"name": "Info Desk", "description": "Be a point of contact for attendees. Either helping with finding things or just getting an idea for what's on."}, {"name": "Tent Steward", "description": "Check the various tents (e.g. Arcade, Lounge, Spillout) are clean and everything's OK."}, {"name": "Youth Workshop Helper", "description": "Help support our youth workshop leaders and participants."}, # Needs training {"name": "NOC", "description": "Plug/Unplug DKs", "role_notes": "Requires training & the DK Key.", "requires_training": True}, {"name": "Bar", "description": "Help run the bar. Serve drinks, take payment, keep it clean.", "role_notes": "Requires training, over 18s only.", "over_18_only": True, "requires_training": True}, {"name": "Volunteer Manager", "description": "Help people sign up for volunteering. Make sure they know where to go. Run admin on the volunteer system.", "role_notes": "Must be trained.", "over_18_only": True, "requires_training": True}, ] for v in venue_list: venue = VolunteerVenue.get_by_name(v['name']) if not venue: db.session.add(VolunteerVenue(**v)) else: venue.mapref = v['mapref'] for r in role_list: role = Role.get_by_name(r['name']) if not role: db.session.add(Role(**r)) else: role.description = r['description'] role.role_notes = r.get('role_notes', None) role.over_18_only = r.get('over_18_only', False) role.requires_training = r.get('requires_training', False) db.session.commit()
def update_venue_from_form(form, venue_id): venue = VolunteerVenue.get_by_id(venue_id) venue.name = form.name.data venue.mapref = form.mapref.data db.session.commit() app.logger.info('%s updated venue, %s (id: %s)', current_user.id, venue.name, venue.id) return venue
def run(self): roles_list = [ "Herald", "Stage: Audio/Visual", "Stage: Camera Operator", "Stage: Vision Mixer", ] venue_list = ["Stage A", "Stage B", "Stage C"] for role_name in roles_list: role = Role.get_by_name(role_name) if role.shifts: for shift in role.shifts: p = shift.proposal app.logger.info("Updating shift") shift.start = get_start_time(p) shift.stop = get_end_time(p) shift.venue = VolunteerVenue.get_by_name( p.scheduled_venue.name) else: for venue_name in venue_list: venue = VolunteerVenue.get_by_name(venue_name) events = (Proposal.query.join( Venue, Proposal.scheduled_venue_id == Venue.id).filter( Venue.name == venue.name, Proposal.state == "finished").all()) for e in events: start = get_start_time(e) stop = get_end_time(e) to_add = Shift( role=role, venue=venue, start=start, end=stop, min_needed=1, max_needed=1, proposal=e, ) db.session.add(to_add) db.session.commit()
def run(self): venues = [ { "name": "Bar", "mapref": "https://map.emfcamp.org/#19/52.0420157/-2.3770749" }, { "name": "Stage A", "mapref": "https://map.emfcamp.org/#17/52.039601/-2.377759" }, { "name": "Stage B", "mapref": "https://map.emfcamp.org/#17/52.041798/-2.376412" }, { "name": "Stage C", "mapref": "https://map.emfcamp.org/#17/52.040482/-2.377432" }, { "name": "Entrance", "mapref": "https://map.emfcamp.org/#18/52.039226/-2.378184" }, ] roles = [ { "name": "Bar", "description": "Serve people booze", "role_notes": "Must be over 18 and complete online training first" }, { "name": "AV", "description": "Make sure folks giving talks can be heard & their slides seen", "role_notes": "" }, { "name": "Entrance Steward", "description": "Check tickets and help people get on site.", "role_notes": "" }, ] for v in venues: db.session.add(VolunteerVenue(**v)) for r in roles: db.session.add(Role(**r)) db.session.commit()
def schedule(): shifts = Shift.get_all() by_time = defaultdict(lambda: defaultdict(list)) if current_user.has_permission("volunteer:admin"): all_volunteers = Volunteer.query.order_by(Volunteer.nickname).all() else: all_volunteers = [] for s in shifts: day_key = s.start.strftime("%a").lower() hour_key = s.start.strftime("%H:%M") to_add = s.to_localtime_dict() to_add["sign_up_url"] = url_for(".shift", shift_id=to_add["id"]) to_add["is_user_shift"] = current_user in s.volunteers by_time[day_key][hour_key].append(to_add) roles = _get_interested_roles(current_user) venues = VolunteerVenue.get_all() untrained_roles = [ r for r in roles if r["is_interested"] and r["requires_training"] and not r["is_trained"] ] if datetime.utcnow() < config_date("EVENT_START"): def_day = "thu" else: def_day = pendulum.now().strftime("%a").lower() active_day = request.args.get("day", default=def_day) return render_template( "volunteer/schedule.html", roles=roles, venues=venues, all_shifts=by_time, active_day=active_day, all_volunteers=all_volunteers, untrained_roles=untrained_roles, )
def run(self): # First = first start time. Final = end of last shift shift_list = { "Herald": { "Stage A": [ { "first": "2018-08-31 12:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage B": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage C": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], }, "Stage: Audio/Visual": { "Stage A": [ { "first": "2018-08-31 12:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage B": [ { "first": "2018-08-31 13:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ], "Stage C": [ { "first": "2018-08-31 13:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ] }, "Stage: Camera Operator": { "Stage A": [ { "first": "2018-08-31 12:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage B": [ { "first": "2018-08-31 13:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ], "Stage C": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ] }, "Stage: Vision Mixer": { "Stage A": [ { "first": "2018-08-31 12:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage B": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ], "Stage C": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ] }, # 'Tent' roles "Badge Helper": { "Badge Tent": [ { "first": "2018-09-01 10:00:00", "final": "2018-09-01 16:00:00", "min": 1, "max": 2 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 16:00:00", "min": 1, "max": 2 }, ] }, "Car Parking": { "Car Park": [ { "first": "2018-08-31 08:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 3 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 16:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 14:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-03 08:00:00", "final": "2018-09-03 12:00:00", "min": 1, "max": 3 }, ] }, "Entrance Steward": { "Entrance": [ { "first": "2018-08-31 08:00:00", "final": "2018-09-03 12:00:00", "min": 2, "max": 4 }, ] }, "Games Master": { "Stage A": [ { "first": "2018-08-31 20:00:00", "final": "2018-08-31 23:00:00", "min": 1, "max": 3 }, { "first": "2018-09-01 20:00:00", "final": "2018-09-01 23:00:00", "min": 1, "max": 3 }, { "first": "2018-09-02 20:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 3 }, ] }, "Green Room": { "Green Room": [ { "first": "2018-08-31 12:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ] }, "Info Desk": { "Info Desk": [ { "first": "2018-08-31 10:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1 }, ] }, "Tent Steward": { "N/A": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 19:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-01 19:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 19:00:00", "min": 1, "max": 1 }, ] }, "Youth Workshop Helper": { "Youth Workshop": [ { "first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 2 }, { "first": "2018-09-01 09:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 2 }, { "first": "2018-09-02 09:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 2 }, ] }, # Require training "Bar": { "Bar": [ { "first": "2018-08-31 11:00:00", "final": "2018-09-01 02:00:00", "min": 2, "max": 5 }, { "first": "2018-09-01 11:00:00", "final": "2018-09-02 02:00:00", "min": 2, "max": 5 }, { "first": "2018-09-02 11:00:00", "final": "2018-09-03 01:00:00", "min": 2, "max": 5 }, ], "Bar 2": [ { "first": "2018-08-31 20:00:00", "final": "2018-09-01 01:00:00", "min": 1, "max": 2 }, { "first": "2018-09-01 17:00:00", "final": "2018-09-02 01:00:00", "min": 1, "max": 2 }, { "first": "2018-09-02 17:00:00", "final": "2018-09-03 00:00:00", "min": 1, "max": 2 }, ] }, "NOC": { "N/A": [ { "first": "2018-08-31 08:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 2 }, { "first": "2018-09-02 14:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 2 }, { "first": "2018-09-03 08:00:00", "final": "2018-09-03 12:00:00", "min": 1, "max": 2 }, ] }, "Volunteer Manager": { "Volunteer Tent": [ { "first": "2018-08-31 11:00:00", "final": "2018-08-31 21:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 09:00:00", "final": "2018-09-01 21:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 09:00:00", "final": "2018-09-02 21:00:00", "min": 1, "max": 1 }, ] }, } for shift_role in shift_list: role = Role.get_by_name(shift_role) if role.shifts: app.logger.info("Skipping making shifts for role: %s" % role.name) continue for shift_venue in shift_list[shift_role]: venue = VolunteerVenue.get_by_name(shift_venue) for shift_ranges in shift_list[shift_role][shift_venue]: shifts = Shift.generate_for( role=role, venue=venue, first=parse(shift_ranges["first"]), final=parse(shift_ranges["final"]), min=shift_ranges["min"], max=shift_ranges["max"]) for s in shifts: db.session.add(s) db.session.commit()
def run(self): venue_list = [{ "name": "Badge Tent", "mapref": "https://map.emfcamp.org/#20.24/52.0405486/-2.3781891" }, { "name": "Bar 2", "mapref": "https://map.emfcamp.org/#19/52.0409755/-2.3786306" }, { "name": "Bar", "mapref": "https://map.emfcamp.org/#19/52.0420157/-2.3770749" }, { "name": "Car Park", "mapref": "https://map.emfcamp.org/#19.19/52.0389412/-2.3783488" }, { "name": "Entrance", "mapref": "https://map.emfcamp.org/#18/52.039226/-2.378184" }, { "name": "Green Room", "mapref": "https://map.emfcamp.org/#20.72/52.0414959/-2.378016" }, { "name": "Info Desk", "mapref": "https://map.emfcamp.org/#21.49/52.0415113/-2.3776567" }, { "name": "Stage A", "mapref": "https://map.emfcamp.org/#17/52.039601/-2.377759" }, { "name": "Stage B", "mapref": "https://map.emfcamp.org/#17/52.041798/-2.376412" }, { "name": "Stage C", "mapref": "https://map.emfcamp.org/#17/52.040482/-2.377432" }, { "name": "Volunteer Tent", "mapref": "https://map.emfcamp.org/#20.82/52.0397817/-2.3767928" }, { "name": "Youth Workshop", "mapref": "https://map.emfcamp.org/#19.46/52.0420979/-2.3753702" }, { "name": "N/A", "mapref": "https://map.emfcamp.org/#16/52.0411/-2.3784" }] role_list = [ # Stage stuff { "name": "Herald", "description": "Introduce talks and manage speakers at stage." }, { "name": "Stage: Audio/Visual", "description": "Run the audio for a stage. Make sure mics are working and that presentations work." }, { "name": "Stage: Camera Operator", "description": "Point, focus and expose the camera, then lock off shot and monitor it." }, { "name": "Stage: Vision Mixer", "description": "Vision mix the output to screen and to stream." }, # "Tent" roles { "name": "Badge Helper", "description": "Fix, replace and troubleshoot badges and their software." }, { "name": "Car Parking", "description": "Help park cars and get people on/off site." }, { "name": "Catering", "description": "Help our excellent catering team provide food for all the volunteers." }, { "name": "Entrance Steward", "description": "Greet people, check their tickets and help them get on site." }, { "name": "Games Master", "description": "Running Indie Games on the big screen in Stage A, and optionally Board Games" }, { "name": "Green Room", "description": "Make sure speakers get where they need to be with what they need." }, { "name": "Info Desk", "description": "Be a point of contact for attendees. Either helping with finding things or just getting an idea for what's on" }, { "name": "Tent Steward", "description": "Check the various tents (e.g. Arcade, Lounge, Spillout) are clean and everything's OK." }, { "name": "Youth Workshop Helper", "description": "Help support our youth workshop leaders and participants." }, # Needs training { "name": "NOC", "description": "Plug/Unplug DKs", "role_notes": "Requires training & the DK Key." }, { "name": "Bar", "description": "Help run the bar. Serve drinks, take payment, keep it clean.", "role_notes": "Requires training, over 18s only." }, { "name": "Volunteer Manager", "description": "Help people sign up for volunteering. Make sure they know where to go. Run admin on the volunteer system.", "role_notes": "Must be trained." }, ] for v in venue_list: venue = VolunteerVenue.get_by_name(v['name']) if not venue: db.session.add(VolunteerVenue(**v)) else: venue.mapref = v['mapref'] for r in role_list: role = Role.get_by_name(r['name']) if not role: db.session.add(Role(**r)) else: role.description = r['description'] role.role_notes = r.get('role_notes', None) db.session.commit()
def volunteer_shifts(): """ Make fake volunteer shifts """ # First = first start time. Final = end of last shift shift_list = { # 'Tent' roles "Badge Helper": { "Badge Tent": [ { "first": "2022-06-04 10:00:00", "final": "2022-06-04 16:00:00", "min": 1, "max": 2, }, { "first": "2022-06-05 10:00:00", "final": "2022-06-05 16:00:00", "min": 1, "max": 2, }, ] }, "Car Parking": { "Car Park": [ { "first": "2022-06-03 08:00:00", "final": "2022-06-03 20:00:00", "min": 1, "max": 3, }, { "first": "2022-06-04 10:00:00", "final": "2022-06-04 16:00:00", "min": 1, "max": 1, }, { "first": "2022-06-05 14:00:00", "final": "2022-06-05 20:00:00", "min": 1, "max": 1, }, { "first": "2022-06-06 08:00:00", "final": "2022-06-06 12:00:00", "min": 1, "max": 3, }, ] }, "Catering": { "Volunteer Tent": [ { "first": "2022-06-03 07:00:00", "final": "2022-06-03 20:00:00", "min": 2, "max": 5, }, { "first": "2022-06-04 07:00:00", "final": "2022-06-04 20:00:00", "min": 2, "max": 5, }, { "first": "2022-06-05 07:00:00", "final": "2022-06-05 20:00:00", "min": 2, "max": 5, }, { "first": "2022-06-06 07:00:00", "final": "2022-06-06 20:00:00", "min": 2, "max": 5, }, ] }, "Entrance Steward": { "Entrance": [{ "first": "2022-06-03 08:00:00", "final": "2022-06-06 12:00:00", "min": 2, "max": 4, }] }, "Games Master": { "Stage A": [ { "first": "2022-06-03 20:00:00", "final": "2022-06-03 23:00:00", "min": 1, "max": 3, }, { "first": "2022-06-04 20:00:00", "final": "2022-06-04 23:00:00", "min": 1, "max": 3, }, { "first": "2022-06-05 20:00:00", "final": "2022-06-05 23:00:00", "min": 1, "max": 3, }, ] }, "Green Room": { "Green Room": [ { "first": "2022-06-03 12:00:00", "final": "2022-06-04 00:00:00", "min": 1, "max": 1, }, { "first": "2022-06-04 10:00:00", "final": "2022-06-05 00:00:00", "min": 1, "max": 1, }, { "first": "2022-06-05 10:00:00", "final": "2022-06-05 20:00:00", "min": 1, "max": 1, }, ] }, "Info Desk": { "Info Desk": [ { "first": "2022-06-03 10:00:00", "final": "2022-06-03 20:00:00", "min": 1, "max": 1, }, { "first": "2022-06-04 10:00:00", "final": "2022-06-04 20:00:00", "min": 1, "max": 1, }, { "first": "2022-06-05 10:00:00", "final": "2022-06-05 20:00:00", "min": 1, "max": 1, }, ] }, "Tent Steward": { "N/A": [ { "first": "2022-06-03 13:00:00", "final": "2022-06-03 19:00:00", "min": 1, "max": 1, }, { "first": "2022-06-04 10:00:00", "final": "2022-06-04 19:00:00", "min": 1, "max": 1, }, { "first": "2022-06-05 10:00:00", "final": "2022-06-05 19:00:00", "min": 1, "max": 1, }, ] }, "Youth Workshop Helper": { "Youth Workshop": [ { "first": "2022-06-03 13:00:00", "final": "2022-06-03 20:00:00", "min": 1, "max": 2, }, { "first": "2022-06-04 09:00:00", "final": "2022-06-04 20:00:00", "min": 1, "max": 2, }, { "first": "2022-06-05 09:00:00", "final": "2022-06-05 20:00:00", "min": 1, "max": 2, }, ] }, # Require training "Bar": { "Bar": [ { "first": "2022-06-03 11:00:00", "final": "2022-06-04 02:00:00", "min": 2, "max": 5, }, { "first": "2022-06-04 11:00:00", "final": "2022-06-05 02:00:00", "min": 2, "max": 5, }, { "first": "2022-06-05 11:00:00", "final": "2022-06-06 01:00:00", "min": 2, "max": 5, }, ], "Bar 2": [ { "first": "2022-06-03 20:00:00", "final": "2022-06-04 01:00:00", "min": 1, "max": 2, }, { "first": "2022-06-04 17:00:00", "final": "2022-06-05 01:00:00", "min": 1, "max": 2, }, { "first": "2022-06-05 17:00:00", "final": "2022-06-06 00:00:00", "min": 1, "max": 2, }, ], }, "NOC": { "N/A": [ { "first": "2022-06-03 08:00:00", "final": "2022-06-03 20:00:00", "min": 1, "max": 2, }, { "first": "2022-06-05 14:00:00", "final": "2022-06-05 20:00:00", "min": 1, "max": 2, }, { "first": "2022-06-06 08:00:00", "final": "2022-06-06 12:00:00", "min": 1, "max": 2, }, ] }, "Volunteer Manager": { "Volunteer Tent": [ { "first": "2022-06-03 11:00:00", "final": "2022-06-03 21:00:00", "min": 1, "max": 1, }, { "first": "2022-06-04 09:00:00", "final": "2022-06-04 21:00:00", "min": 1, "max": 1, }, { "first": "2022-06-05 09:00:00", "final": "2022-06-05 21:00:00", "min": 1, "max": 1, }, ] }, } for shift_role in shift_list: role = Role.get_by_name(shift_role) if role.shifts: app.logger.info("Skipping making shifts for role: %s" % role.name) continue for shift_venue in shift_list[shift_role]: venue = VolunteerVenue.get_by_name(shift_venue) for shift_ranges in shift_list[shift_role][shift_venue]: shifts = Shift.generate_for( role=role, venue=venue, first=parse(shift_ranges["first"]), final=parse(shift_ranges["final"]), min=shift_ranges["min"], max=shift_ranges["max"], ) for s in shifts: db.session.add(s) db.session.commit()
def run(self): venue_list = [ { "name": "Bar", "mapref": "https://map.emfcamp.org/#19/52.0420157/-2.3770749" }, { "name": "Stage A", "mapref": "https://map.emfcamp.org/#17/52.039601/-2.377759" }, { "name": "Stage B", "mapref": "https://map.emfcamp.org/#17/52.041798/-2.376412" }, { "name": "Stage C", "mapref": "https://map.emfcamp.org/#17/52.040482/-2.377432" }, { "name": "Entrance", "mapref": "https://map.emfcamp.org/#18/52.039226/-2.378184" }, ] role_list = [ { "name": "Bar", "description": "Serve people booze", "role_notes": "Must be over 18 and complete online training first" }, { "name": "AV", "description": "Make sure folks giving talks can be heard & their slides seen", "role_notes": "" }, { "name": "Entrance Steward", "description": "Check tickets and help people get on site.", "role_notes": "" }, ] shift_list = { "Bar": { "Bar": [ { "first": "2018-08-31 11:00:00", "final": "2018-09-01 01:00:00", "min": 2, "max": 5 }, { "first": "2018-09-01 11:00:00", "final": "2018-09-02 01:00:00", "min": 2, "max": 5 }, { "first": "2018-09-02 11:00:00", "final": "2018-09-03 00:00:00", "min": 2, "max": 5 }, ] }, "AV": { "Stage A": [ { "first": "2018-08-31 12:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ], "Stage B": [ { "first": "2018-08-31 12:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ], "Stage C": [ { "first": "2018-08-31 12:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1 }, { "first": "2018-09-02 10:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 1 }, ] }, "Entrance Steward": { "Entrance": [ { "first": "2018-08-31 08:00:00", "final": "2018-09-03 12:00:00", "min": 2, "max": 4 }, ] } } for v in venue_list: db.session.add(VolunteerVenue(**v)) for r in role_list: db.session.add(Role(**r)) for shift_role in shift_list: role = Role.get_by_name(shift_role) for shift_venue in shift_list[shift_role]: venue = VolunteerVenue.get_by_name(shift_venue) for shift_ranges in shift_list[shift_role][shift_venue]: shifts = Shift.generate_for( role=role, venue=venue, first=parse(shift_ranges["first"]), final=parse(shift_ranges["final"]), min=shift_ranges["min"], max=shift_ranges["max"]) for s in shifts: db.session.add(s) db.session.commit()
def get_venues(): return VolunteerVenue.get_all()
def get_venue_by_id(id): return VolunteerVenue.get_by_id(id)
def init_form_with_venue(form, venue_id): venue = VolunteerVenue.get_by_id(venue_id) form.id.data = venue.id form.name.data = venue.name form.mapref.data = venue.mapref return form
def run(self): # First = first start time. Final = end of last shift shift_list = { # 'Tent' roles "Badge Helper": { "Badge Tent": [ {"first": "2018-09-01 10:00:00", "final": "2018-09-01 16:00:00", "min": 1, "max": 2}, {"first": "2018-09-02 10:00:00", "final": "2018-09-02 16:00:00", "min": 1, "max": 2}, ] }, "Car Parking": { "Car Park": [ {"first": "2018-08-31 08:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 3}, {"first": "2018-09-01 10:00:00", "final": "2018-09-01 16:00:00", "min": 1, "max": 1}, {"first": "2018-09-02 14:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1}, {"first": "2018-09-03 08:00:00", "final": "2018-09-03 12:00:00", "min": 1, "max": 3}, ] }, "Catering": { "Volunteer Tent": [ {"first": "2018-08-31 07:00:00", "final": "2018-08-31 20:00:00", "min": 2, "max": 5}, {"first": "2018-09-01 07:00:00", "final": "2018-09-01 20:00:00", "min": 2, "max": 5}, {"first": "2018-09-02 07:00:00", "final": "2018-09-02 20:00:00", "min": 2, "max": 5}, {"first": "2018-09-03 07:00:00", "final": "2018-09-03 20:00:00", "min": 2, "max": 5}, ] }, "Entrance Steward": { "Entrance": [ {"first": "2018-08-31 08:00:00", "final": "2018-09-03 12:00:00", "min": 2, "max": 4}, ] }, "Games Master": { "Stage A": [ {"first": "2018-08-31 20:00:00", "final": "2018-08-31 23:00:00", "min": 1, "max": 3}, {"first": "2018-09-01 20:00:00", "final": "2018-09-01 23:00:00", "min": 1, "max": 3}, {"first": "2018-09-02 20:00:00", "final": "2018-09-02 23:00:00", "min": 1, "max": 3}, ] }, "Green Room": { "Green Room": [ {"first": "2018-08-31 12:00:00", "final": "2018-09-01 00:00:00", "min": 1, "max": 1}, {"first": "2018-09-01 10:00:00", "final": "2018-09-02 00:00:00", "min": 1, "max": 1}, {"first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1}, ] }, "Info Desk": { "Info Desk": [ {"first": "2018-08-31 10:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 1}, {"first": "2018-09-01 10:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 1}, {"first": "2018-09-02 10:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 1}, ] }, "Tent Steward": { "N/A": [ {"first": "2018-08-31 13:00:00", "final": "2018-08-31 19:00:00", "min": 1, "max": 1}, {"first": "2018-09-01 10:00:00", "final": "2018-09-01 19:00:00", "min": 1, "max": 1}, {"first": "2018-09-02 10:00:00", "final": "2018-09-02 19:00:00", "min": 1, "max": 1}, ] }, "Youth Workshop Helper": { "Youth Workshop": [ {"first": "2018-08-31 13:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 2}, {"first": "2018-09-01 09:00:00", "final": "2018-09-01 20:00:00", "min": 1, "max": 2}, {"first": "2018-09-02 09:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 2}, ] }, # Require training "Bar": { "Bar": [ {"first": "2018-08-31 11:00:00", "final": "2018-09-01 02:00:00", "min": 2, "max": 5}, {"first": "2018-09-01 11:00:00", "final": "2018-09-02 02:00:00", "min": 2, "max": 5}, {"first": "2018-09-02 11:00:00", "final": "2018-09-03 01:00:00", "min": 2, "max": 5}, ], "Bar 2": [ {"first": "2018-08-31 20:00:00", "final": "2018-09-01 01:00:00", "min": 1, "max": 2}, {"first": "2018-09-01 17:00:00", "final": "2018-09-02 01:00:00", "min": 1, "max": 2}, {"first": "2018-09-02 17:00:00", "final": "2018-09-03 00:00:00", "min": 1, "max": 2}, ] }, "NOC": { "N/A": [ {"first": "2018-08-31 08:00:00", "final": "2018-08-31 20:00:00", "min": 1, "max": 2}, {"first": "2018-09-02 14:00:00", "final": "2018-09-02 20:00:00", "min": 1, "max": 2}, {"first": "2018-09-03 08:00:00", "final": "2018-09-03 12:00:00", "min": 1, "max": 2}, ] }, "Volunteer Manager": { "Volunteer Tent": [ {"first": "2018-08-31 11:00:00", "final": "2018-08-31 21:00:00", "min": 1, "max": 1}, {"first": "2018-09-01 09:00:00", "final": "2018-09-01 21:00:00", "min": 1, "max": 1}, {"first": "2018-09-02 09:00:00", "final": "2018-09-02 21:00:00", "min": 1, "max": 1}, ] }, } for shift_role in shift_list: role = Role.get_by_name(shift_role) if role.shifts: app.logger.info("Skipping making shifts for role: %s" % role.name) continue for shift_venue in shift_list[shift_role]: venue = VolunteerVenue.get_by_name(shift_venue) for shift_ranges in shift_list[shift_role][shift_venue]: shifts = Shift.generate_for(role=role, venue=venue, first=parse(shift_ranges["first"]), final=parse(shift_ranges["final"]), min=shift_ranges["min"], max=shift_ranges["max"]) for s in shifts: db.session.add(s) db.session.commit()