<div style="background: white;">
<ul>
{% block courses %}
- <li><a href="{% url teleforma-exam-scripts-pending period.id %}">{% trans "Pending" %}{% if user.is_staff or user.quotass.all %}{% untreated_scripts_count user.username period.id %}{% endif %}</a></li>
- <li><a href="{% url teleforma-exam-scripts-treated period.id %}">{% trans "Marked" %}{% if not user.is_staff and not user.quotas.all %}{% treated_scripts_count user.username period.id %}{% endif %}</a></li>
+ <li><a href="{% url teleforma-exam-scripts-pending period.id %}">{% trans "Pending" %}{% if user.is_staff or user.quotass.all %}{% untreated_scripts_count user period %}{% endif %}</a></li>
+ <li><a href="{% url teleforma-exam-scripts-treated period.id %}">{% trans "Marked" %}{% if not user.is_staff and not user.quotas.all %}{% treated_scripts_count user period %}{% endif %}</a></li>
<li><a href="{% url teleforma-exam-scripts-rejected period.id %}">{% trans "Rejected" %}</a></li>
{% endblock courses %}
</ul>
{% if periods|length == 1 %}
{% with periods.0 as period %}
- <li><a href="{% url teleforma-exam-scripts-pending period.id %}" class="green"> {% trans "Scripts" %}
- {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user.username period.id %}
- {% else %}{% treated_scripts_count user.username period.id %}{% endif %}</a>
+ <li><a href="{% url teleforma-exam-scripts-pending period %}" class="green"> {% trans "Scripts" %}
+ {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user period %}
+ {% else %}{% treated_scripts_count user period %}{% endif %}</a>
</li>
{% endwith %}
{% else %}
<li><a href="#scripts#" class="green"> {% trans "Scripts" %}
- {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user.username period.id %}
- {% else %}{% treated_scripts_count user.username period.id %}{% endif %}</a>
+ {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user period %}
+ {% else %}{% treated_scripts_count user period %}{% endif %}</a>
<ul>
{% for period in periods %}
<li><a href="{% url teleforma-exam-scripts-pending period.id %}" class="green">{{ period.name }}</a></li>
return doc.filter(is_published=True)
@register.simple_tag
-def untreated_scripts_count(username, period_id):
- user = User.objects.get(username=username)
- period = Period.objects.get(id=period_id)
+def untreated_scripts_count(user, period):
scripts = Script.objects.filter(Q(status=3, author=user, period=period) | Q(status=3, corrector=user, period=period))
if scripts:
return ' (' + str(len(scripts)) + ')'
return ''
@register.simple_tag
-def treated_scripts_count(username, period_id):
- user = User.objects.get(username=username)
- period = Period.objects.get(id=period_id)
+def treated_scripts_count(user, period):
scripts = Script.objects.filter(Q(status=4, author=user, period=period) | Q(status=4, corrector=user, period=period))
if scripts:
return ' (' + str(len(scripts)) + ')'