def METHOD_NAME():
    bar = Role.query.filter_by(name="Bar").one_or_none()
    cybar = Role.query.filter_by(name="Cybar").one_or_none()
    if bar is None or cybar is None:
        abort(404)
    volunteer = Volunteer.get_for_user(current_user)
    trained = bar in volunteer.trained_roles
    training_json_path = app.config.get(
        "BAR_TRAINING_JSON", "models/fixtures/training/bar.json"
    )
    training_json = load_training_json(training_json_path)
    if training_json is None:  # Error loading training data
        app.logger.error(
            f"Bar training failed -- unable to load JSON: '{training_json_path}'"
        )
        abort(404)
    global question_data  # Otherwise we can't access it in the form validator
    question_data = build_questions(training_json)
    form = TrainingForm()
    form.add_questions(question_data)
    if form.validate_on_submit():
        if trained:  # The user might be re-doing the traing, no need to rewrite DB
            flash("You answered all the questions correctly!")
        else:
            app.logger.info(f"{str(current_user)} passed the bar training.")
            bar.trained_volunteers.append(volunteer)
            cybar.trained_volunteers.append(volunteer)
            db.session.commit()
            flash("Your completion of bar training has been saved.")
        return redirect(url_for(".bar_training"))
    # The template takes a list of pages which it will build sequentially, start
    # building this list now.
    pages = []
    page_num = 0
    for json_page in training_json["pages"]:
        page = {}
        page_num += 1
        page["number"] = page_num
        page["content"] = load_training_markdown(json_page["content"])
        if page["content"] is None:
            app.logger.error(
                f"Bar training failed -- unable to load Markdown: '{json_page['content']}'"
            )
            abort(404)
        page["questions"] = json_page["questions"]
        pages.append(page)
    return render_template(
        "volunteer/training/bar-training.html",
        trained=trained,
        form=form,
        pages=pages,
        last_page=len(pages),
        volunteer=volunteer,
    )