Пример #1
0
def api_root():
    """ View for root url - API instructions """
    # @@@ TODO make tag list generation a dedicated method
    conn = Connector(instance=settings.__cohort_data_instance__)
    conn._cur_.execute("select utm_name from usertags_meta")
    data = [r[0] for r in conn._cur_]
    del conn

    if settings.__flask_login_exists__ and current_user.is_anonymous():
        return render_template("index_anon.html", cohort_data=data, m_list=get_metric_names())
    else:
        return render_template("index.html", cohort_data=data, m_list=get_metric_names())
Пример #2
0
def cohort(cohort=""):
    """ View single cohort page """
    error = get_errors(request.args)

    # @TODO CALL COHORT VALIDATION HERE

    if not cohort:
        return redirect(url_for("all_cohorts"))
    else:
        return render_template("cohort.html", c_str=cohort, m_list=get_metric_names(), error=error)