diff --git a/contests/handlers/compare.py b/contests/handlers/compare.py index d82d806..63ce1ef 100644 --- a/contests/handlers/compare.py +++ b/contests/handlers/compare.py @@ -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.""" diff --git a/contests/handlers/triage.py b/contests/handlers/triage.py index 35ea61a..af548e1 100644 --- a/contests/handlers/triage.py +++ b/contests/handlers/triage.py @@ -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): @@ -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 @@ -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__ @@ -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 diff --git a/contests/management/commands/load_reverts.py b/contests/management/commands/load_reverts.py index 6b0e0c6..f1acdfc 100644 --- a/contests/management/commands/load_reverts.py +++ b/contests/management/commands/load_reverts.py @@ -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 diff --git a/contests/templates/edits.txt b/contests/templates/edits.txt index 98ed539..9641794 100644 --- a/contests/templates/edits.txt +++ b/contests/templates/edits.txt @@ -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 %} \ No newline at end of file diff --git a/contests/templates/triage.html b/contests/templates/triage.html index 7fda185..e7d4490 100644 --- a/contests/templates/triage.html +++ b/contests/templates/triage.html @@ -162,13 +162,13 @@
{% trans 'With image?' context 'withimage' %}
{% trans 'Evaluation' context 'triage-evaluation' %} class="w3-radio w3-section" type="radio" id="pic-sim" - name="pic" + name="picture" value="sim" required>