Пример #1
0
def render_pinned_projects(owner, form=None):
    pinned = [pin.copr for pin in PinnedCoprsLogic.get_by_owner(owner)]
    if isinstance(owner, models.Group):
        UsersLogic.raise_if_not_in_group(flask.g.user, owner)
        coprs = CoprsLogic.get_multiple_by_group_id(owner.id).filter(
            models.Copr.unlisted_on_hp.is_(False)).all()
    else:
        coprs = ComplexLogic.get_coprs_permissible_by_user(owner)
    coprs = sorted(coprs, key=lambda copr: copr.full_name)
    selected = [copr.id for copr in pinned]
    selected += (app.config["PINNED_PROJECTS_LIMIT"] - len(pinned)) * [None]
    for i, copr_id in enumerate(form.copr_ids.data if form else []):
        selected[i] = int(copr_id) if copr_id else None

    graph = BuildsLogic.get_small_graph_data('30min')
    return flask.render_template("pinned.html",
                                 owner=owner,
                                 pinned=pinned,
                                 selected=selected,
                                 coprs=coprs,
                                 form=form,
                                 tasks_info=ComplexLogic.get_queue_sizes(),
                                 graph=graph)
Пример #2
0
def render_user_info(user):
    graph = BuildsLogic.get_small_graph_data('30min')
    return flask.render_template("user_info.html",
                                 user=user,
                                 tasks_info=ComplexLogic.get_queue_sizes(),
                                 graph=graph)