def manage_attendees(): # Getting names of users and also volunteers that are down as attending this Jam jam_attendees = database.get_all_attendees_for_jam( database.get_current_jam_id()) volunteer_attendances = database.get_attending_volunteers( database.get_current_jam_id(), only_attending_volunteers=True) for volunteer_attendee in volunteer_attendances: for volunteer_attendee_record in volunteer_attendee.attending: if volunteer_attendee_record.jam_id == database.get_current_jam_id( ): volunteer_attendee.current_jam = volunteer_attendee_record break volunteer_attendee.current_location = volunteer_attendee.current_jam.current_location volunteer_attendee.attendee_id = volunteer_attendee.user_id volunteer_attendee.order_id = "Volunteer" jam_attendees.append(volunteer_attendee) for attendee in jam_attendees: if attendee.current_location == "Checked in": attendee.bg_colour = database.green elif attendee.current_location == "Checked out": attendee.bg_colour = database.yellow elif attendee.current_location == "Not arrived": attendee.bg_colour = database.light_grey #jam_attendees = sorted(jam_attendees, key=lambda x: x.order_id, reverse=False) jam_attendees = sorted(jam_attendees, key=lambda x: x.current_location, reverse=False) return render_template("admin/manage_attendees.html", attendees=jam_attendees)
def volunteer_attendance(): volunteer_attendances = database.get_attending_volunteers(database.get_current_jam_id()) form = forms.VolunteerAttendance(request.form) if request.method == 'POST' and form.validate(): database.add_volunteer_attendance(database.get_current_jam_id(), request.logged_in_user.user_id, int(literal_eval(form.attending_jam.data)), int(literal_eval(form.attending_setup.data)), int(literal_eval(form.attending_packdown.data)), int(literal_eval(form.attending_food.data)), form.notes.data) return redirect(("/admin/volunteer_attendance"), code=302) return render_template("admin/volunteer_attendance.html", form=form, volunteer_attendances=volunteer_attendances, user_id=request.logged_in_user.user_id, eventbrite_event_name = database.get_jam_details(database.get_current_jam_id()).name)
def fire_list(): jam_attendees = database.get_all_attendees_for_jam(database.get_current_jam_id()) volunteer_attendances = database.get_attending_volunteers(database.get_current_jam_id(), only_attending_volunteers=True) for volunteer_attendee in volunteer_attendances: for volunteer_attendee_record in volunteer_attendee.attending: if volunteer_attendee_record.jam_id == database.get_current_jam_id(): volunteer_attendee.current_jam = volunteer_attendee_record break if volunteer_attendee.current_jam.current_location != "Checked in": continue # If volunteer is not marked as checked in, ignore them volunteer_attendee.current_location = volunteer_attendee.current_jam.current_location volunteer_attendee.attendee_id = volunteer_attendee.user_id volunteer_attendee.order_id = "Volunteer" jam_attendees.append(volunteer_attendee) return render_template("admin/fire_list.html", attendees=jam_attendees)