{% block webclass %}
{% include "webclass/inc/webclass_list.html" %}
{% endblock %}
+
+ </div>
+
+ <div class="course">
+ <div class="course_title">{{ course.title }} - Corrections de copies{% if course.description %} -
+ {{ course.description }}{% endif %}
+ </div>
+ {% block webclass_corrections %}
+ {% include "webclass/inc/webclass_corrections_list.html" %}
+ {% endblock %}
</div>
{% endwith %}
{% endfor %}
return {
'periods':periods,
}
+
+
+@register.inclusion_tag('webclass/webclass_record.html', takes_context=True)
+def webclass_record(context, record):
+ return {
+ 'record':record
+ }
context['webclass'] = webclass
context['webclass_slot'] = webclass_slot
+ records = {}
try:
- context['webclass_records'] = WebclassRecord.get_records(
- context['period'], course)
+ records = WebclassRecord.get_records(context['period'], course)
except Exception as e:
print(e)
context['webclass_error'] = True
+ context['webclass_records'] = records.get(WebclassRecord.WEBCLASS)
+ context['webclass_corrections_records'] = records.get(WebclassRecord.CORRECTION)
return context
@method_decorator(access_required)
search_fields = ['id', 'course__code', 'course__title']
class WebclassRecordAdmin(admin.ModelAdmin):
- list_filter = ('course', 'period')
- list_display = ('course', 'period', 'created')
+ list_filter = ('course', 'period', 'category')
+ list_display = ('course', 'period', 'category', 'created')
search_fields = ['id', 'course__code', 'course__title']
# def get_form(self, request, obj=None, **kwargs):
--- /dev/null
+# Generated by Django 3.2.3 on 2021-07-13 16:08
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('webclass', '0004_auto_20210616_1654'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='webclassrecord',
+ name='category',
+ field=models.CharField(choices=[('WC', 'Webclass'), ('CC', 'Correction de copie')], default='WC', max_length=2, verbose_name='Catégorie'),
+ ),
+ ]
'BBBServer', related_name='webclass_records', verbose_name='Serveur BBB', on_delete=models.CASCADE)
created = models.DateTimeField("Date de la conférence", auto_now_add=True)
+ WEBCLASS = 'WC'
+ CORRECTION = 'CC'
+ CATEGORY_CHOICES = [
+ (WEBCLASS, 'Webclass'),
+ (CORRECTION, 'Correction de copie'),
+ ]
+ category = models.CharField(
+ "Catégorie",
+ max_length=2,
+ choices=CATEGORY_CHOICES,
+ default=WEBCLASS,
+ )
+
class Meta(MetaCore):
db_table = app_label + '_' + 'webclass_record'
verbose_name = 'enregistrement'
@staticmethod
def get_records(period, course):
record_ids = set()
+ # id : category mapping
+ category_mapping = {}
for record in WebclassRecord.objects.filter(period=period, course=course):
record_ids.add(record.record_id)
+ category_mapping[record.record_id] = record.category
if not record_ids:
return []
records = get_records_from_bbb(recording_id=','.join(record_ids))
- return records
+
+ # group records by category
+ categories = {}
+ for record in records:
+ category = category_mapping[record['id']]
+ if category not in categories:
+ categories[category] = []
+ categories[category].append(record)
+
+ return categories
--- /dev/null
+{% load teleforma_tags webclass %}
+{% load i18n %}
+
+{% if webclass_corrections_records %}
+<div class="course_content content_video">
+ <table class="listing" width="100%">
+ <tbody>
+
+ {% for record in webclass_corrections_records %}
+ {% webclass_record record %}
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+{% else %}
+<div class="course_content">
+ <p>Aucun document</p>
+</div>
+{% endif %}
\ No newline at end of file
-{% load teleforma_tags %}
+{% load teleforma_tags webclass %}
{% load i18n %}
{% if webclass_slot or webclass_records %}
</tr>
{% endif %}
{% for record in webclass_records %}
- <tr>
- <td {% if forloop.first %}class="border-top" {% endif %} style="width:200px">
- <a href="{% url 'teleforma-webclass-record' %}?url={{record.url}}" title="{% trans "View" %}">
- <img src="{{ record.preview }}" style="width:176px" alt="{% trans 'Click here' %}" />
- <div>Cliquez-ici</div>
- </a>
- </td>
- <td {% if forloop.first %}class="border-top" {% endif %} style="padding-left: 1em;">
- <div>
- <dl class="listing" style="font-size: 1.2em;">
- {% if record.slot %}
- <dt>{% trans "Professor" %}</dt>
- <dd>{{ record.slot.professor }}</dd>
- {% endif %}
- <dt>{% trans "Begin" %}</dt>
- <dd>{{ record.start_date }}</dd>
- </dl>
- </div>
- </td>
- <div style="padding-left: 1em;">
-
- </div>
- </tr>
+ {% webclass_record record %}
{% endfor %}
</tbody>
</table>
</div>
+{% else %}
+<div class="course_content">
+ <p>Aucun document</p>
+</div>
{% endif %}
\ No newline at end of file
--- /dev/null
+{% load i18n %}
+
+<tr>
+ <td {% if forloop.first %}class="border-top" {% endif %} style="width:200px">
+ <a href="{% url 'teleforma-webclass-record' %}?url={{record.url}}" title="{% trans "View" %}">
+ <img src="{{ record.preview }}" style="width:176px" alt="{% trans 'Click here' %}" />
+ <div>Cliquez-ici</div>
+ </a>
+ </td>
+ <td {% if forloop.first %}class="border-top" {% endif %} style="padding-left: 1em;">
+ <div>
+ <dl class="listing" style="font-size: 1.2em;">
+ {% if record.slot %}
+ <dt>{% trans "Professor" %}</dt>
+ <dd>{{ record.slot.professor }}</dd>
+ {% endif %}
+ <dt>{% trans "Begin" %}</dt>
+ <dd>{{ record.start_date }}</dd>
+ </dl>
+ </div>
+ </td>
+ <div style="padding-left: 1em;">
+
+ </div>
+</tr>
\ No newline at end of file