Anton Shestakov <av6@dwimlabs.net>, Sun, 24 Sep 2017 12:25:05 +0800
viewer: use subqueries to get data on index page
Before, there were bare columns in the aggregate query, their values were
undefined (but it somehow worked), as SQLite docs say. Good news is that now
this bigger query uses (project_id, ordinal) index and is really fast.
templates/project.html
Permissions: -rw-r--r--
{% extends "base.html" %} {% block title %}{{ project.name }}{% end %} <link rel="alternate" href="{{ project.get_url() }}/atom" type="application/atom+xml" title="{{ project.name }} feed"> <div class="uk-container uk-container-center uk-margin-large-top"> <h2>{% module Template('ui/project-link.html', project=project) %}</h2> <img src="{{ project.get_url() }}/status.svg" alt="Lint Status"> {% include ui/codes.html %} <dl class="uk-description-list-horizontal list-terse"> {% if project.url.startswith(('http:', 'https:')) %} <a href="{{ project.url }}"><i class="uk-icon-external-link"></i></a> {% set last = checks.first() %} {% module Time(last.finished) %} <a href="{{ project.get_url() }}/atom"><i class="uk-icon-rss-square"></i></a> <table class="uk-table uk-table-middle uk-text-nowrap"> {% set paged_checks = handler.paginate(checks) %} {% for check in paged_checks.iterator() %} {% set change = check.change %} {% set adapter = project.get_adapter() %} <td class="uk-text-right">{% module Badges(check) %}</td> <td><a href="{{ project.get_url() }}/{{ check.ordinal }}">check #
{{ check.ordinal }}</a></td> <td><a href="{{ adapter.get_branch_url(change) }}">{{ change.branch }}</a></td> <td><a href="{{ adapter.get_commit_url(change) }}">{% if change.rev is not None %}{{ change.rev }}:
{% end %}{{ change.node[:12] }}</a></td> <td class="uk-width-1-1"> <div class="wrap-normal">{{ change.message }}</div> <div>{{ change.author }},
{% module Time(change.date, False) %}</div> <td>{% module Time(check.finished) %}</td> <td>{{ check.get_duration() }}</td> {% if paged_checks.pages > 1 %} {% module Pagination(paged_checks.page, paged_checks.pages) %}