From 1e99b603227473cb6dfda0088c61a10f77117cc6 Mon Sep 17 00:00:00 2001
From: OIOIOI <oioioi@dasie.mimuw.edu.pl>
Date: Mon, 10 Feb 2014 12:05:39 +0100
Subject: [PATCH 02/37] similarsubmits & disqualification minor changes

Change-Id: I5eec2928c4446fecfca14de66ee2a726d5688ee9
---
 oioioi/disqualification/controllers.py             |    7 +++++--
 .../static/common/disqualification.less            |    8 +++++++-
 .../templates/disqualification/generic.html        |    2 +-
 .../templates/disqualification/generic_admin.html  |    2 +-
 .../templates/disqualification/my_submissions.html |    2 +-
 oioioi/similarsubmits/controllers.py               |    3 +++
 .../programming_similar_submissions.html           |    1 -
 7 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/oioioi/disqualification/controllers.py b/oioioi/disqualification/controllers.py
index a6b4bf1..4e21d05 100644
--- a/oioioi/disqualification/controllers.py
+++ b/oioioi/disqualification/controllers.py
@@ -45,8 +45,11 @@ class DisqualificationContestControllerMixin(object):
         if is_contest_admin(request) or is_contest_observer(request):
             return normally
 
+#
+# widzi swoj wynik w innych zgloszeniach do konkursu C
+# Tak.
+#                not self.is_user_disqualified(request, request.user) and \
         return normally and \
-                not self.is_user_disqualified(request, request.user) and \
                 not self.is_any_submission_to_problem_disqualified(
                     submission.user, submission.problem_instance)
 
@@ -104,7 +107,7 @@ class DisqualificationContestControllerMixin(object):
     def render_my_submissions_header(self, request, submissions):
         return super(DisqualificationContestControllerMixin, self) \
             .render_my_submissions_header(request, submissions) + \
-            self.render_disqualification(request, submissions)
+            self.render_disqualifications(request, submissions)
 
     def render_disqualifications(self, request, submissions):
         if not self.is_user_disqualified(request, request.user):
diff --git a/oioioi/disqualification/static/common/disqualification.less b/oioioi/disqualification/static/common/disqualification.less
index a09a31e..ffdce24 100644
--- a/oioioi/disqualification/static/common/disqualification.less
+++ b/oioioi/disqualification/static/common/disqualification.less
@@ -5,6 +5,12 @@ tr.disqualified > td {
     background-color: @errorBackground !important;
 }
 
+.disqualification-box {
+    blockquote p {
+        font-size: @baseFontSize;
+    }
+}
+
 .disqualification-reason {
     margin-left: 15px;
 }
@@ -12,6 +18,6 @@ tr.disqualified > td {
 .disqualification-submission-reason {
     margin-top: 10px;
     h4 {
-        font-size: 14px;
+        font-size: @baseFontSize;
     }
 }
diff --git a/oioioi/disqualification/templates/disqualification/generic.html b/oioioi/disqualification/templates/disqualification/generic.html
index 0d04ebb..01b33aa 100644
--- a/oioioi/disqualification/templates/disqualification/generic.html
+++ b/oioioi/disqualification/templates/disqualification/generic.html
@@ -2,7 +2,7 @@
 {% load check_perm %}
 {% check_perm 'contests.contest_admin' for contest as is_admin %}
 
-<div class="alert alert-danger alert-block">
+<div class="alert alert-danger alert-block disqualification-box">
     <h4>{% trans "Disqualification" %}</h4>
     {% blocktrans %}
     <p>
diff --git a/oioioi/disqualification/templates/disqualification/generic_admin.html b/oioioi/disqualification/templates/disqualification/generic_admin.html
index fcfc9e1..e6d5991 100644
--- a/oioioi/disqualification/templates/disqualification/generic_admin.html
+++ b/oioioi/disqualification/templates/disqualification/generic_admin.html
@@ -2,7 +2,7 @@
 {% load check_perm %}
 {% check_perm 'contests.contest_admin' for contest as is_admin %}
 
-<div class="alert alert-warning alert-block">
+<div class="alert alert-warning alert-block disqualification-box">
     <h4>{% trans "Disqualification (admin panel)" %}</h4>
     {{ reason }}
 </div>
diff --git a/oioioi/disqualification/templates/disqualification/my_submissions.html b/oioioi/disqualification/templates/disqualification/my_submissions.html
index e1ba97b..2db0152 100644
--- a/oioioi/disqualification/templates/disqualification/my_submissions.html
+++ b/oioioi/disqualification/templates/disqualification/my_submissions.html
@@ -2,7 +2,7 @@
 {% load check_perm %}
 {% check_perm 'contests.contest_admin' for contest as is_admin %}
 
-<div class="alert alert-error alert-block">
+<div class="alert alert-error alert-block disqualification-box">
     <h3>{% trans "Disqualification" %}</h3>
     {% if submissions %}
     {% blocktrans %}
diff --git a/oioioi/similarsubmits/controllers.py b/oioioi/similarsubmits/controllers.py
index e69d1f6..0da99a8 100644
--- a/oioioi/similarsubmits/controllers.py
+++ b/oioioi/similarsubmits/controllers.py
@@ -60,6 +60,9 @@ class SimilarityDisqualificationMixin(object):
         prev = super(SimilarityDisqualificationMixin, self) \
                 .filter_visible_sources(request, queryset)
 
+        if not request.user.is_authenticated():
+            return prev
+
         # TODO: only in grace period, guilty
         # Do not split this filter as it spans many-to-many relationship
         similar = queryset.filter(
diff --git a/oioioi/similarsubmits/templates/similarsubmits/programming_similar_submissions.html b/oioioi/similarsubmits/templates/similarsubmits/programming_similar_submissions.html
index 7151764..b490058 100644
--- a/oioioi/similarsubmits/templates/similarsubmits/programming_similar_submissions.html
+++ b/oioioi/similarsubmits/templates/similarsubmits/programming_similar_submissions.html
@@ -12,7 +12,6 @@
 
     {% for group in similarities %}
     <div class="similarity-group">
-        <h6>{% trans "Group" %}</h6>
         {# Admin comment is for admins only #}
         <table class="{% block table-classes %}table auto-width dense space-columns submissions_list{% endblock %}">
             <thead>
-- 
1.7.9.5

