feat: add Score model
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luca 2024-02-14 01:45:33 +01:00
parent ca3ca52ab2
commit 5df8a8b29b
4 changed files with 44 additions and 5 deletions

View File

@ -0,0 +1,34 @@
# Generated by Django 4.2.8 on 2024-02-14 00:36
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("submission", "0072_alter_reviewscore_label"),
("pretalx_musicrate", "0008_assignee"),
]
operations = [
migrations.CreateModel(
name="Score",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("value", models.FloatField()),
(
"submission",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="submission.submission",
),
),
],
),
]

View File

@ -112,3 +112,8 @@ class Assignee(models.Model):
user = models.ForeignKey( user = models.ForeignKey(
"person.User", on_delete=models.CASCADE, related_name="assigned_submissions" "person.User", on_delete=models.CASCADE, related_name="assigned_submissions"
) )
class Score(models.Model):
submission = models.OneToOneField("submission.Submission", on_delete=models.CASCADE)
value = models.FloatField()

View File

@ -65,8 +65,8 @@
<tr> <tr>
<th> <th>
{% translate "Rating" %} {% translate "Rating" %}
<a href="?{% url_replace request 'sort' 'rating' %}"><i class="fa fa-caret-down" title="{% translate "Sort by rating (10-0)" %}"></i></a> <a href="?{% url_replace request 'sort' 'score' %}"><i class="fa fa-caret-down" title="{% translate "Sort by rating (10-0)" %}"></i></a>
<a href="?{% url_replace request 'sort' '-rating' %}"><i class="fa fa-caret-up" title="{% translate "Sort by rating (0-10)" %}"></i></a> <a href="?{% url_replace request 'sort' '-score' %}"><i class="fa fa-caret-up" title="{% translate "Sort by rating (0-10)" %}"></i></a>
</th> </th>
<th> <th>
{% translate "Title" %} {% translate "Title" %}
@ -97,8 +97,8 @@
{% for submission in submissions %} {% for submission in submissions %}
<tr> <tr>
<td> <td>
{% if submission.rating %} {% if submission.score %}
{{ submission.rating.value }} {{ submission.score.value }}
{% else %} {% else %}
&ndash; &ndash;
{% endif %} {% endif %}

View File

@ -479,7 +479,7 @@ class AssigneeView(EventPermissionRequired, FormView, SingleObjectMixin):
class EnhancedSubmissionList(SubmissionList): class EnhancedSubmissionList(SubmissionList):
sortable_fields = ("code", "rating", "title", "state", "assignee") sortable_fields = ("code", "score", "title", "state", "assignee")
template_name = "pretalx_musicrate/enhanced_list.html" template_name = "pretalx_musicrate/enhanced_list.html"
def get_filter_form(self): def get_filter_form(self):