contentdb/app/templates/packages/review_votes.html

92 lines
2.5 KiB
HTML
Raw Normal View History

2022-01-01 23:17:39 +01:00
{% extends "base.html" %}
{% block title %}
{{ _("Review Votes") }}
{% endblock %}
{% block link %}
<a href="{{ package.get_url("packages.view") }}">{{ package.title }}</a>
2022-01-01 23:17:39 +01:00
{% endblock %}
{% block content %}
<h1>{{ _("Review votes on %(title)s by %(author)s", title=self.link(), author=package.author.display_name) }}</h1>
<h2>Helpful Biases</h2>
{% set total_reviews = reviews | length %}
<p>
This section shows whether users tend vote in a way that agrees or disagrees with a package.
Total reviews: {{ total_reviews }}.
</p>
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Balance</th>
<th>With Pkg</th>
<th>Against Pkg</th>
<th>No Vote</th>
</tr>
</thead>
<tbody>
{% for info in user_biases %}
{% set total_votes = info.with_ + info.against %}
<tr
{% if total_votes > 3 and total_votes > total_reviews * 0.5 and ((info.balance / total_votes) | abs) > 0.8 %}
style="color: #e74c3c;"
{% elif total_votes > 3 and ((info.balance / total_votes) | abs) > 0.9 %}
style="color: #f39c12;"
{% endif %}>
<td>{{ info.username }}</td>
<td>{{ info.balance }}</td>
<td>{{ info.with_ }} ({{ info.perc_with }}%)</td>
<td>{{ info.against }} ({{ 100 - info.perc_with }}%)</td>
<td>{{ info.no_vote }}</td>
</tr>
{% else %}
<tr><td colspan=3><i>No votes</i></td></tr>
{% endfor %}
</tbody>
</table>
<h2>Reviews</h2>
<table class="table">
{% for review in reviews %}
<tr>
<th colspan="2">
2023-04-15 03:37:58 +02:00
{% if review.rating > 3 %}
<i class="fas fa-thumbs-up text-success mr-2"></i>
2023-04-15 03:37:58 +02:00
{% elif review.rating < 3 %}
2022-01-01 23:17:39 +01:00
<i class="fas fa-thumbs-down text-danger mr-2"></i>
2023-04-15 03:37:58 +02:00
{% else %}
<i class="fas fa-minus mr-2"></i>
2022-01-01 23:17:39 +01:00
{% endif %}
<a href="{{ review.thread.get_view_url() }}">
2022-01-01 23:17:39 +01:00
{{ review.thread.title }}
</a> by {{ review.author.display_name }}
</th>
</tr>
<tr>
<td>
{% for vote in review.votes %}
{% if vote.is_positive %}
<a href="{{ url_for('users.profile', username=vote.user.username) }}" class="badge badge-secondary">
{{ vote.user.username }}
</a>
{% endif %}
{% endfor %}
</td>
<td>
{% for vote in review.votes %}
{% if not vote.is_positive %}
<a href="{{ url_for('users.profile', username=vote.user.username) }}" class="badge badge-secondary">
{{ vote.user.username }}
</a>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
2023-04-15 03:37:58 +02:00
{% endblock %}