Esempio n. 1
0
def showMetricsPage():
    lastMetrics = {}
    currentMetrics = {}
    now = getValidMonth()
    month = now.strftime("%Y%m")
    client = Client.query.get(current_user.id)
    mday = datetime.now().day
    if mday > 25 or mday < 23:
        return render_template("showNoMetricsPage.tpl", client=client)

    for pu in client.pus:
        #last
        metrics = Metric.query.filter(Metric.month != month).filter_by(
            pu=pu).order_by(Metric.month.desc()).limit(1).all()
        for metric in metrics:
            lastMetrics[metric.pu.id] = metric.m.split(";")
        # current
        metrics = Metric.query.filter_by(pu=pu, month=month).order_by(
            Metric.month.desc()).limit(1).all()
        for metric in metrics:
            currentMetrics[metric.pu.id] = metric.m.split(";")
    client = clientSchema.dump(client).data
    return render_template("showMetricsPage.tpl",
                           client=client,
                           lastMetrics=lastMetrics,
                           currentMetrics=currentMetrics,
                           month=month,
                           months=months)
Esempio n. 2
0
def showFondClientMetricsPage(clientId):
    client = Client.query.get_or_404(clientId)
    pus = [pu.id for pu in client.pus]
    metrics = Metric.query.filter(Metric.puId.in_(pus)).order_by(
        Metric.month.desc()).all()
    client = clientSchema.dump(client).data
    metrics = metricsSchema.dump(metrics).data
    return render_template("fond/showFondClientMetricsPage.tpl",
                           client=client,
                           metrics=metrics,
                           datetime=datetime)
Esempio n. 3
0
def showFondClientPage(clientId):
    client = Client.query.get_or_404(clientId)
    return render_template("fond/showFondClientPage.tpl",
                           client=clientSchema.dump(client).data)
Esempio n. 4
0
def showEditDialog():
    client = Client.query.get(current_user.id)
    return render_template("showEditDialog.tpl",
                           client=clientSchema.dump(client).data)
Esempio n. 5
0
def defaultPrivatePage():
    client = Client.query.get(current_user.id)
    return render_template("defaultPrivatePage.tpl",
                           client=clientSchema.dump(client).data)