Download this file

index.html.svn-base    342 lines (331 with data), 11.1 kB

{% set hide_left_bar = True %}
{% extends g.theme.master %}

{% block title %}User stats{% endblock %}

{% block header %}
    Statistics about {{user.display_name}}'s contribution
    {% if category %}
        in projects of category {{category.fullname}}
    {% endif %}
{% endblock %}

{% block content %}
  {% if user %}

    <h2>General statistics</h2>
    <table>
      <thead>
        <tr>
          <th>Parameter</th>
          <th>Value</th>
        </tr>
      </thead>
      <tbody> 
        <tr>
          <td>Registration date</td>
          <td>
            {{registration_date.strftime("%d %b %Y, %H:%M:%S (UTC)")}}, 
            {{days}} day{% if days != 1 %}s{% endif %} ago</td>
        </tr>
        {% if last_login %}
          <tr>
            <td>Last login</td>
            <td>
              {{last_login.strftime("%d %b %Y, %H:%M:%S (UTC)")}},
              {{last_login_days}} day{% if last_login_days != 1 %}s{% endif %} ago</td>
            </td>
          </tr>
        {% endif %}
      </tbody>
    </table>

    <h2>Contribution statistics</h2>

    <table>
      <thead>
        <tr>
          <th>Parameter</th>
          <th>Total value</th>
          <th>Average per-month value</th>
          <th>Last 30 days</th>
          {% if days >= 30 %}
            <th>Trend</th>
          {% endif %}
        </tr>
      </thead>
      <tbody>
        {% if not category %}
          <tr>
            <td>Logins</td>
            <td>{{totlogins}}</td>
            <td>{{permonthlogins}}</td>
            <td>{{lastmonth_logins}}</td>
            {% if days >= 30 %}
              <td>
                {% if lastmonth_logins > permonthlogins %}
                  Up
                {% elif lastmonth_logins == permonthlogins %}
                  =
                {% else %}
                  Down
                {%endif%}
              </td>
            {% endif %}
          </tr>
        {% endif %}
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/commits/">Commits number</a></td>
          <td>{{totcommits.number}}</td>
          <td>{{permonthcommits.number}}</td>
          <td>{{lastmonthcommits.number}}</td>
          {% if days >= 30 %}
            <td>
              {% if permonthcommits.number > permonthcommits.number %}
                Up
              {% elif permonthcommits.number == permonthcommits.number %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/commits/">Added/modified LOCs</a></td>
          <td>{{totcommits.lines}}</td>
          <td>{{permonthcommits.lines}}</td>
          <td>{{lastmonthcommits.lines}}</td>
          {% if days >= 30 %}
            <td>
              {% if permonthcommits.lines > permonthcommits.lines %}
                Up
              {% elif permonthcommits.lines == permonthcommits.lines %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/artifacts/">Total number of created artifacts</a></td>
          <td>{{totartifacts.created}}</td>
          <td>{{permonthartifacts.created}}</td>
          <td>{{lastmonthartifacts.created}}</td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthartifacts.created > permonthartifacts.created %}
                Up
              {% elif lastmonthartifacts.created == permonthartifacts.created %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/commits/">Total number of edited artifacts</a></td>
          <td>{{totartifacts.modified}}</td>
          <td>{{permonthartifacts.modified}}</td>
          <td>{{lastmonthartifacts.modified}}</td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthartifacts.modified > permonthartifacts.modified %}
                Up
              {% elif lastmonthartifacts.modified == permonthartifacts.modified %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        
        {% for key, value in artifacts_by_type.items() %}
          <tr>
            <td><a href="/userstats/{{user.username}}/metric/artifacts/">Created {{key}} artifacts</a></td>
            <td>{{value.created}}</td>
            <td>{{value.pmcreated}}</td>
            <td>
              {% if lastmonth_artifacts_by_type.get(key) %}
                 {{lastmonth_artifacts_by_type[key].created}}
              {% else %}
                 0
              {% endif %}
            </td>
            {% if days >= 30 %}
              <td>
                {% if lastmonth_artifacts_by_type.get(key) %}
                  {% if lastmonth_artifacts_by_type[key].created > value.pmcreated %}
                    Up
                  {% elif lastmonth_artifacts_by_type[key].created == value.pmcreated %}
                    =
                  {% else %}
                    Down
                  {%endif%}
                {%else%} Down {%endif%}
              </td>
            {% endif %}
          </tr>
          <tr>
            <td><a href="/userstats/{{user.username}}/metric/artifacts/">Edited {{key}} artifacts</a></td>
            <td>{{value.modified}}</td>
            <td>{{value.pmmodified}}</td>
            <td>
              {% if lastmonth_artifacts_by_type.get(key) %}
                 {{lastmonth_artifacts_by_type[key].modified}}
              {% else %}
                 0
              {% endif %}
            </td>
            {% if days >= 30 %}
              <td>
                {% if lastmonth_artifacts_by_type.get(key) %}
                  {% if lastmonth_artifacts_by_type[key].modified > value.pmmodified %}
                    Up
                  {% elif lastmonth_artifacts_by_type[key].modified == value.pmmodified %}
                    =
                  {% else %}
                    Down
                  {%endif%}
                {%else%} Down {%endif%}
              </td>
            {% endif %}
          </tr>
        {% endfor %}

        <tr>
          <td><a href="/userstats/{{user.username}}/metric/tickets/">Assigned tickets</a></td>
          <td>{{tottickets.assigned}}</td>
          <td>{{permonthtickets.assigned}}</td>
          <td>{{lastmonthtickets.assigned}}</td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthtickets.assigned > permonthtickets.assigned %}
                Up
              {% elif lastmonthtickets.assigned == permonthtickets.assigned %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/tickets/">Revoked tickets</a></td>
          <td>{{tottickets.revoked}}</td>
          <td>{{permonthtickets.revoked}}</td>
          <td>{{lastmonthtickets.revoked}}</td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthtickets.revoked > permonthtickets.revoked %}
                Up
              {% elif lastmonthtickets.revoked == permonthtickets.revoked %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/tickets/">Solved tickets</a></td>
          <td>{{tottickets.solved}}</td>
          <td>{{permonthtickets.solved}}</td>
          <td>{{lastmonthtickets.solved}}</td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthtickets.solved > permonthtickets.solved %}
                Up
              {% elif lastmonthtickets.solved == permonthtickets.solved %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
        <tr>
          <td><a href="/userstats/{{user.username}}/metric/tickets/">Average tickets solving time</a></td>
          <td>
            {% if tottickets.averagesolvingtime %}
              {{tottickets.averagesolvingtime.days}} days, 
              {{tottickets.averagesolvingtime.hours}} hours,
              {{tottickets.averagesolvingtime.minutes}} min
            {% else %}n/a{% endif %}
          </td>
          <td>n/a</td>
          <td>
            {% if lastmonthtickets.averagesolvingtime %}
              {{lastmonthtickets.averagesolvingtime.days}} days, 
              {{lastmonthtickets.averagesolvingtime.hours}} hours,
              {{lastmonthtickets.averagesolvingtime.minutes}} min
            {% else %}n/a{% endif %}
          </td>
          {% if days >= 30 %}
            <td>
              {% if lastmonthtickets.averagesolvingtime > tottickets.averagesolvingtime %}
                Up
              {% elif lastmonthtickets.averagesolvingtime == tottickets.averagesolvingtime %}
                =
              {% else %}
                Down
              {%endif%}
            </td>
          {% endif %}
        </tr>
      </tbody>
    </table>

    {% if categories %}
        <h2>Prefered categories</h2>
        <table>
          <thead>
            <tr>
              <th>Category name</th>
              <th>Number of projects</th>
            </tr>
          </thead>
          <tbody>
            {% for cat, count in categories %}
              <tr>
                <td><a href="/userstats/{{user.username}}/category/{{cat.fullname}}">{{cat.fullname}}</a></td>
                <td>{{count}}</td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
    {% endif %}
    {% if category %}
        <div class="grid-20"><a href="/userstats/{{user.username}}">Go back to general statistics</a></div>
    {% else %}
      <h2>Overall evaluation</h2>
      <table>
        <thead>
          <tr>
            <th>Field</th>
            <th>Evaluation</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Code contribution</td>
            <td>
               {% for i in range(codestars) %}★{% endfor %}
               {% for i in range(5 - codestars) %}☆{% endfor %}
            </td>
          </tr>
          <tr>
            <td>Contribution to discussions on the forge</td>
            <td>
               {% for i in range(discussionstars) %}★{% endfor %}
               {% for i in range(5 - discussionstars) %}☆{% endfor %}
            </td>
          </tr>
          <tr>
            <td>Contribution to issues solving</td>
            <td>
              {% for i in range(ticketsstars) %}★{% endfor %}
              {% for i in range(5 - ticketsstars) %}☆{% endfor %}
            </td>
          </tr>
        </tbody>
      </table>
    {% endif %}
  {% else %}
    Invalid user!
  {% endif %}

{% endblock %}