def _toggle_shift_entry(user, shift): res = {} shift_entry = ShiftEntry.query.filter_by(user_id=user.id, shift_id=shift.id).first() if shift.role == Role.get_by_name('Bar') and \ Role.get_by_name('Bar') not in Volunteer.get_for_user(current_user).trained_roles: return { 'warning': 'Missing required training', 'message': 'You must complete bar training before you can sign up for this shift' } if shift_entry: db.session.delete(shift_entry) res['operation'] = 'delete' res['message'] = 'Cancelled %s shift' % shift.role.name else: for v_shift in user.shift_entries: if shift.is_clash(v_shift.shift): res['warning'] = "WARNING: Clashes with an existing shift" shift.entries.append(ShiftEntry(user=user, shift=shift)) res['operation'] = 'add' res['message'] = 'Signed up for %s shift' % shift.role.name return res
def _toggle_shift_entry(user, shift): res = {} shift_entry = ShiftEntry.query.filter_by(user_id=user.id, shift_id=shift.id).first() if (shift.role == Role.get_by_name("Bar") and Role.get_by_name("Bar") not in Volunteer.get_for_user(current_user).trained_roles): return { "warning": "Missing required training", "message": "You must complete bar training before you can sign up for this shift", } if shift_entry: db.session.delete(shift_entry) res["operation"] = "delete" res["message"] = "Cancelled %s shift" % shift.role.name else: for v_shift in user.shift_entries: if shift.is_clash(v_shift.shift): res["warning"] = "WARNING: Clashes with an existing shift" shift.entries.append(ShiftEntry(user=user, shift=shift)) res["operation"] = "add" res["message"] = "Signed up for %s shift" % shift.role.name return res
def choose_role(): form = RoleSignupForm() form.add_roles(Role.get_all()) current_volunteer = VolunteerUser.get_for_user(current_user) if form.validate_on_submit(): current_role_ids = [r.id for r in current_volunteer.interested_roles] for r in form.roles: r_id = r._role.id if r.signup.data and r_id not in current_role_ids: current_volunteer.interested_roles.append(r._role) elif not r.signup.data and r_id in current_role_ids: current_volunteer.interested_roles.remove(r._role) db.session.commit() flash("Your role list has been updated", 'info') return redirect(url_for('.choose_role')) current_roles = current_volunteer.interested_roles.all() if current_roles: role_ids = [r.id for r in current_roles] form.select_roles(role_ids) return render_template('volunteer/choose_role.html', form=form)
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): 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 _get_interested_roles(user): roles = Role.get_all() volunteer = Volunteer.get_for_user(user) res = [] for r in roles: to_add = r.to_dict() to_add["is_interested"] = r in volunteer.interested_roles to_add["is_trained"] = r in volunteer.trained_roles res.append(to_add) return res
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 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 train_users(role_id): role = Role.get_by_id(role_id) form = TrainingForm() form.add_volunteers(Volunteer.get_all()) if form.validate_on_submit(): changes = 0 for v in form.volunteers: if v.trained.data and v._volunteer not in role.trained_volunteers: changes += 1 role.trained_volunteers.append(v._volunteer) elif not v.trained.data and v._volunteer in role.trained_volunteers: changes += 1 role.trained_volunteers.remove(v._volunteer) db.session.commit() flash("Trained %d volunteers" % changes) app.logger.info("Trained %d volunteers" % changes) return redirect(url_for(".train_users", role_id=role_id)) for v in role.trained_volunteers: for f in form.volunteers: if f.volunteer_id.data == v.id: f.trained.data = True break # Sort people who've been trained to the top then by nickname form.volunteers = sorted( form.volunteers, key=lambda f: (-1 if f.trained.data else 1, f._volunteer.nickname), ) return render_template("volunteer/training/train_users.html", role=role, form=form)
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 select_training(): return render_template("volunteer/training/select_training.html", roles=Role.get_all())
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 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()