def status(): if not auth_utils.check_login(): return auth_utils.login_redirect() status = helpers.check_status(flask.session['username'], flask.session['username']) return flask.render_template("dashboard.html", status=status)
def rsvp(): if not auth_utils.check_login(): return auth_utils.login_redirect() accepted = helpers.check_accepted(flask.session['username'], flask.session['username']) return flask.render_template("rsvp.html", accepted=accepted)
def update_status(): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] helpers.update_status( email, flask.request.form.get("RSVPed") or flask.request.form.get("Declined"), None) return flask.redirect(flask.url_for(".status"))
def update_applications(): """Handles an application update request.""" if not auth_utils.check_login(): return auth_utils.login_redirect() action = flask.request.form.get("Submit") or flask.request.form.get("Save") email = flask.session['username'] first_name = flask.request.form.get("firstName", None) middle_name = flask.request.form.get("middleName", None) last_name = flask.request.form.get("lastName", None) preferred_name = flask.request.form.get("preferredName", None) phone_number = flask.request.form.get("phoneNumber", None) school = flask.request.form.get("school", None) major = flask.request.form.get("major", None) degree_type = flask.request.form.get("degreeType", None) graduation_year = flask.request.form.get("graduationYear", None) github = flask.request.form.get("github", None) linkedin = flask.request.form.get("linkedin", None) # Special cases for major and school not in options if school == "N/A" or not school: school_opt = flask.request.form.get("school_opt", None) school = school if school_opt == None or school_opt == "" else school_opt if major == "N/A" or not major: major = flask.request.form.get("major_opt", None) # Check if the request has a resume attached resume_file = None if 'resume' in flask.request.files: resume_file = flask.request.files['resume'] latino = flask.request.form.get("latino", None) race = flask.request.form.getlist("race", None) gender = flask.request.form.get("gender", None) shirt_size = flask.request.form.get("shirtSize", None) need_transportation = flask.request.form.get("needTransportation", None) bus_from = flask.request.form.get("busFrom", None) airport = flask.request.form.get("airport", None) dietary_restrictions = flask.request.form.get("dietaryRestrictions", None) diet_choices = flask.request.form.getlist("dietaryRestrictionsChoices", None) diet_details = flask.request.form.get("dietaryRestrictionsDetail", None) q1 = flask.request.form.get("Q1", None) q2 = flask.request.form.get("Q2", None) q3 = flask.request.form.get("Q3", None) q4 = flask.request.form.get("Q4", None) code_of_conduct = (flask.request.form.get("codeOfConduct1", None) == "True") \ and (flask.request.form.get("codeOfConduct2", None) == "True") success, msg = helpers.handle_update_applications( action, email, phone_number, school, major, degree_type, graduation_year, github, linkedin, resume_file, latino, race, gender, shirt_size, need_transportation, bus_from, airport, dietary_restrictions, diet_choices, diet_details, q1, q2, q3, q4, code_of_conduct, first_name, middle_name, last_name, preferred_name) # Display message from application update flask.flash(msg) return flask.redirect( flask.url_for("applications.applications", submit=True if action == "Submit" else False))
def waivers(): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] user_id = auth_utils.get_user_id(email) return flask.render_template( "waivers.html", RSVPed=(judging_helpers.get_status(user_id)['status'] == "RSVPed"), caltech_waiver=helpers.get_waiver_status(user_id, "caltech_waiver"), medical_info=helpers.get_waiver_status(user_id, "medical_info"))
def update_medical_info(): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] if 'medical_info' in flask.request.files: waiver_file = flask.request.files['medical_info'] else: flask.flash("Please upload your filled medical information!") flask.redirect(flask.url_for(".medical_information")) helpers.save_info(email, waiver_file, "MEDICAL", "medical_info") flask.flash( "Thanks for submitting your medical information! A Hacktech organizer will check and make sure that your info is complete." ) return flask.redirect(flask.url_for(".waivers"))
def update_caltech_waiver(): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] if 'caltech_waiver' in flask.request.files: waiver_file = flask.request.files['caltech_waiver'] else: flask.flash("Please upload your filled waiver!") flask.redirect(flask.url_for(".caltech_waiver")) helpers.save_info(email, waiver_file, "WAIVERS", "caltech_waiver") flask.flash( "Thanks for submitting a waiver! A Hacktech organizer will check and make sure that your waiver is complete." ) return flask.redirect(flask.url_for(".waivers"))
def general_waiver(waiver_type, link, title): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] # TODO: implement #status = helpers.submitted_caltech_waiver(email, waiver_type) form_info = judging_helpers.get_waiver(auth_utils.get_user_id(email), waiver_type) form_info['waiver_name'] = form_info[waiver_type + '_url'].split("/")[-1] form_info['waiver_url'] = form_info[waiver_type + '_url'] form_info['waiver_update'] = flask.url_for( ".update_{0}".format(waiver_type)) form_info['waiver_type'] = waiver_type return flask.render_template("caltech_waiver.html", form_info=form_info, waiver_type=waiver_type, link=link, title=title)
def applications(): if not auth_utils.check_login(): return auth_utils.login_redirect() email = flask.session['username'] submitted = flask.request.args.get("submit", "") majors = helpers.get_majors() schools = helpers.get_schools() form_info, validations = helpers.get_form_info(email) form_info.major_opt = form_info.major if form_info.major not in majors else "" form_info.school_opt = form_info.school if form_info.school not in schools else "" if form_info.school_opt != "": form_info.school = "N/A" if form_info.major_opt != "": form_info.major = "N/A" if submitted != "True": validations = helpers.ValidationForm() return flask.render_template("applications.html", schools=schools, majors=majors, form_info=form_info, submitted=(helpers.check_submitted( email, email)), validations=validations.info)