crocodoc.api_token = settings.BOX_API_TOKEN
SCRIPT_STATUS = ((0, _('rejected')), (1, _('draft')), (2, _('submitted')),
- (3, _('pending')),(4, _('marked')) )
+ (3, _('pending')),(4, _('marked')), (5, _('read')) )
REJECT_REASON = ((1, _('unreadable')),
(2, _('bad orientation')), (3, _('bad framing')), (4, _('incomplete')),)
def submit(self):
self.date_submitted = datetime.datetime.now()
self.url = settings.MEDIA_URL + unicode(self.file)
- self.box_uuid = crocodoc.document.upload(url=self.url)
+ try:
+ self.box_uuid = crocodoc.document.upload(url=self.url)
+ except:
+ pass
if not self.corrector:
self.auto_set_corrector()
</thead>
<tbody id="spacing">
{% for script in object_list %}
- <tr>
+ <tr style="font-weight: bold;">
<td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.course.title }}</a></td>
<td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.session }}</a></td>
<td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.type }}</a></td>
if not access:
context['access_error'] = access_error
context['message'] = contact_message
+
+ if script.status == 4 and self.request.user == script.author:
+ script.status = 5
+ script.save()
+
return context
@method_decorator(login_required)
def get_queryset(self):
user = self.request.user
period = Period.objects.get(id=self.kwargs['period_id'])
- scripts = Script.objects.filter(Q(status=3, author=user, period=period) | Q(status=3, corrector=user, period=period))
+ Q1 = Q(status=3, author=user, period=period)
+ Q2 = Q(status=3, corrector=user, period=period)
+ scripts = Script.objects.filter(Q1 | Q2)
return scripts
def get_context_data(self, **kwargs):
def get_queryset(self):
user = self.request.user
- scripts = Script.objects.filter(Q(status=4, author=user) | Q(status=4, corrector=user))
+ Q1 = Q(status=4, author=user)
+ Q2 = Q(status=5, author=user)
+ Q3 = Q(status=4, corrector=user)
+ Q4 = Q(status=5, corrector=user)
+ scripts = Script.objects.filter(Q1 | Q2 | Q3 | Q4)
return scripts
def get_context_data(self, **kwargs):
def get_queryset(self):
user = self.request.user
- scripts = Script.objects.filter(Q(status=0, author=user) | Q(status=0, corrector=user))
+ Q1 = Q(status=0, author=user)
+ Q2 = Q(status=0, corrector=user)
+ scripts = Script.objects.filter(Q1 | Q2)
return scripts
def get_context_data(self, **kwargs):
{% if exam_access %}
{% if periods|length == 1 %}
- <li><a href="{% url teleforma-exam-scripts-pending periods.0.id %}" class="green"> {% trans "Scripts" %}
- {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user periods.0.id %}
+ <li><a href="{% url teleforma-exam-scripts-pending periods.0.id %}" class="green"> {% trans "Scripts" %}
+ {% if user.is_staff or user.quotas.all %}{% untreated_scripts_count user periods.0.id %}
{% else %}{% treated_scripts_count user periods.0.id %}{% endif %}</a>
</li>
{% else %}
- <li><a href="#scripts#" class="green"> {% trans "Scripts" %}
- {% if user.is_staff or user.correctors.all %}{% untreated_scripts_count user periods.0.id %}
+ <li><a href="#scripts#" class="green"> {% trans "Scripts" %}
+ {% if user.is_staff or user.quotas.all %}{% untreated_scripts_count user periods.0.id %}
{% else %}{% treated_scripts_count user periods.0.id %}{% endif %}</a>
<ul>
{% for period in periods %}
@register.simple_tag
def untreated_scripts_count(user, period):
- scripts = Script.objects.filter(Q(status=3, author=user, period=period) | Q(status=3, corrector=user, period=period))
+ Q1 = Q(status=3, author=user, period=period)
+ Q2 = Q(status=3, corrector=user, period=period)
+ scripts = Script.objects.filter(Q1 | Q2)
if scripts:
return ' (' + str(len(scripts)) + ')'
else:
@register.simple_tag
def treated_scripts_count(user, period):
- scripts = Script.objects.filter(Q(status=4, author=user, period=period) | Q(status=4, corrector=user, period=period))
+ Q1 = Q(status=4, author=user, period=period)
+ Q2 = Q(status=4, corrector=user, period=period)
+ scripts = Script.objects.filter(Q1 | Q2)
if scripts:
return ' (' + str(len(scripts)) + ')'
else: