Skip to content

Commit

Permalink
Merge branch 'release/1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoleoncio committed Oct 23, 2024
2 parents e836aa3 + 17c3a8f commit 7a30c64
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions contests/handlers/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ def fix_inconsistent_edit(self, contest, diff):
qualif = Qualification.objects.create(
contest=contest,
status='0',
diff=Edit.objects.get(diff=diff),
diff=Edit.objects.get(contest=contest, diff=diff),
evaluator=Evaluator.objects.get(contest=contest, profile=self.user.profile),
)
Edit.objects.filter(diff=diff).update(last_qualification=qualif)
Edit.objects.filter(contest=contest, diff=diff).update(last_qualification=qualif)

def get_inconsistent_edits(self, contest):
"""Coleta edições inconsistentes."""
Expand Down
14 changes: 7 additions & 7 deletions contests/handlers/triage.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def skip_edit(self, diff):
evaluation = Evaluation.objects.create(
contest=self.contest,
evaluator=Evaluator.objects.get(contest=self.contest, profile=self.user.profile),
diff=Edit.objects.get(diff=diff),
diff=Edit.objects.get(contest=self.contest, diff=diff),
status='3'
)
Edit.objects.filter(diff=diff).update(last_evaluation=evaluation)
Edit.objects.filter(contest=self.contest, diff=diff).update(last_evaluation=evaluation)
return evaluation

def release_edit(self):
Expand All @@ -129,7 +129,7 @@ def release_edit(self):
diff=skip,
status='0' # Status '0' indicates the edit is pending
)
Edit.objects.filter(diff=skip.diff).update(last_evaluation=evaluation)
Edit.objects.filter(contest=self.contest, diff=skip.diff).update(last_evaluation=evaluation)

return skipped

Expand All @@ -146,19 +146,19 @@ def evaluate_edit(self, request):
picture = True if picture_input == 'sim' else False

overwrite_value = request.POST.get('overwrite')
real_bytes = int(overwrite_value) if overwrite_value and overwrite_value.isnumeric() else Edit.objects.get(diff=diff).orig_bytes
real_bytes = int(overwrite_value) if overwrite_value and overwrite_value.isnumeric() else Edit.objects.get(contest=self.contest, diff=diff).orig_bytes

evaluation = Evaluation.objects.create(
contest=self.contest,
evaluator=Evaluator.objects.get(contest=self.contest, profile=self.user.profile),
diff=Edit.objects.get(diff=request.POST.get('diff')),
diff=Edit.objects.get(contest=self.contest, diff=diff),
valid_edit=True if request.POST.get('valid') == 'sim' else False,
pictures=picture,
real_bytes=real_bytes,
status='1',
obs=request.POST.get('obs') or None
)
Edit.objects.filter(diff=diff).update(last_evaluation=evaluation)
Edit.objects.filter(contest=self.contest, diff=diff).update(last_evaluation=evaluation)

return evaluation.__dict__

Expand Down Expand Up @@ -191,7 +191,7 @@ def unhold_edit(self):
diff=locked.diff,
status='0' # Status '0' indicates the edit is pending
)
Edit.objects.filter(diff=locked.diff).update(last_evaluation=evaluation)
Edit.objects.filter(contest=self.contest, diff=locked.diff).update(last_evaluation=evaluation)

return lockeds

Expand Down
4 changes: 2 additions & 2 deletions contests/management/commands/load_reverts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def handle(self, *args, **options):
):
new_qualification = Qualification.objects.create(
contest=contest,
diff=Edit.objects.get(diff=diff),
diff=Edit.objects.get(contest=contest, diff=diff),
status=0,
)
Edit.objects.filter(diff=diff).update(last_qualification=new_qualification)
Edit.objects.filter(contest=contest, diff=diff).update(last_qualification=new_qualification)
self.stdout.write(f"Marcada edição {diff} como revertida.")

# Encerra script
Expand Down
5 changes: 2 additions & 3 deletions contests/templates/edits.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% load titlescore %}{% load i18n %}SEP=,
"{% trans 'Edit diff' context 'edits-diff' %}","{% trans 'Article CurID' context 'edits-curid' %}","{% trans 'Title' context 'edits-title' %}","{% trans 'Edit timestamp' context 'edits-timestamp' %}","{% trans 'User' context 'edits-user' %}","{% trans 'Account attach date' context 'edits-attached' %}","{% trans 'Bytes' context 'edits-bytes' %}","{% trans 'New article' context 'edits-newpage' %}","{% trans 'Valid edit' context 'edits-valid' %}","{% trans 'Enrolled user' context 'edits-enrolled' %}","{% trans 'With image' context 'edits-withimage' %}","{% trans 'Reverted edit' context 'edits-reverted' %}","{% trans 'Evaluator' context 'edits-evaluator' %}","{% trans 'Evaluation timestamp' context 'edits-evaltimestamp' %}","{% trans "Evaluator's comment" context 'edits-comment' %}"
{% for query in data %}"{{ query.diff | addslashes }}",{{ query.article.articleID | addslashes }}","{{ query.article.title | titlescore | addslashes }}","{{ query.timestamp | addslashes }}","{{ query.participant.user | addslashes }}","{{ query.participant.attached | addslashes }}","{{ query.orig_bytes | addslashes }}","{{ query.new_page | addslashes}}","{{ query.last_evaluation.valid_edit | addslashes}}","{% if query.participant is None %}Never{% else %}{{ query.participant.last_enrollment.enrolled }}{% endif %}","{{ query.last_evaluation.pictures | addslashes}}","{% if query.last_qualification.status == "1" %}False{% else %}True{% endif %}","{{ query.last_evaluation.evaluator.profile | addslashes}}","{{ query.last_evaluation.when | addslashes}}","{{ query.last_evaluation.obs | default_if_none:'' | addslashes }}"
{% load titlescore %}{% load i18n %}"{% trans 'Edit diff' context 'edits-diff' %}","{% trans 'Article CurID' context 'edits-curid' %}","{% trans 'Title' context 'edits-title' %}","{% trans 'Edit timestamp' context 'edits-timestamp' %}","{% trans 'User' context 'edits-user' %}","{% trans 'Account attach date' context 'edits-attached' %}","{% trans 'Bytes' context 'edits-bytes' %}","{% trans 'New article' context 'edits-newpage' %}","{% trans 'Valid edit' context 'edits-valid' %}","{% trans 'Enrolled user' context 'edits-enrolled' %}","{% trans 'With image' context 'edits-withimage' %}","{% trans 'Reverted edit' context 'edits-reverted' %}","{% trans 'Evaluator' context 'edits-evaluator' %}","{% trans 'Evaluation timestamp' context 'edits-evaltimestamp' %}","{% trans "Evaluator's comment" context 'edits-comment' %}"
{% for query in data %}"{{ query.diff | addslashes }}","{{ query.article.articleID | addslashes }}","{{ query.article.title | titlescore | addslashes }}","{{ query.timestamp | addslashes }}","{{ query.participant.user | addslashes }}","{{ query.participant.attached | addslashes }}","{{ query.orig_bytes | addslashes }}","{{ query.new_page | addslashes}}","{{ query.last_evaluation.valid_edit | addslashes}}","{% if query.participant is None %}Never{% else %}{{ query.participant.last_enrollment.enrolled }}{% endif %}","{{ query.last_evaluation.pictures | addslashes}}","{% if query.last_qualification.status == "1" %}False{% else %}True{% endif %}","{{ query.last_evaluation.evaluator.profile | addslashes}}","{{ query.last_evaluation.when | addslashes}}","{{ query.last_evaluation.obs | default_if_none:'' | addslashes }}"
{% endfor %}
8 changes: 4 additions & 4 deletions contests/templates/triage.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ <h2>{% trans 'Evaluation' context 'triage-evaluation' %}</h2>
<label for="valid-nao">{% trans 'No' context 'no' %}</label><br><br>
</div>
<div class="w3-container w3-cell w3-col l6 m12 s6">
{% if contest.picture_mode == 2 %}
{% if contest.pictures_mode == 2 %}
<p>{% trans 'With image?' context 'withimage' %}</p>
<input
class="w3-input w3-section"
type="number"
id="pic"
name="pic"
name="picture"
value="0"
min="0"
max="9"
Expand All @@ -180,15 +180,15 @@ <h2>{% trans 'Evaluation' context 'triage-evaluation' %}</h2>
class="w3-radio w3-section"
type="radio"
id="pic-sim"
name="pic"
name="picture"
value="sim"
required>
<label for="pic-sim">{% trans 'Yes' context 'yes' %}</label><br>
<input
class="w3-radio w3-section"
type="radio"
id="pic-nao"
name="pic"
name="picture"
value="nao"
required>
<label for="pic-nao">{% trans 'No' context 'no' %}</label><br><br>
Expand Down
2 changes: 1 addition & 1 deletion contests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def edits_view(request, contest):
)

if request.POST.get('csv'):
response = HttpResponse(content_type="text/csv; charset=windows-1252",
response = HttpResponse(content_type="text/csv; charset=utf-8",
headers={"Content-Disposition": 'attachment; filename="edits.csv"'})
response.write(loader.get_template("edits.txt").render({'data': edits}))
return response
Expand Down

0 comments on commit 7a30c64

Please sign in to comment.