Add missing statistics
This commit is contained in:
parent
89961dc301
commit
5a77a3dd12
|
|
@ -147,7 +147,23 @@
|
||||||
Anzahl erfasste Inhaltsblöcke pro Klasse
|
Anzahl erfasste Inhaltsblöcke pro Klasse
|
||||||
</h3>
|
</h3>
|
||||||
<div class="statistic__value">
|
<div class="statistic__value">
|
||||||
0
|
{{ content_block_by_users_count }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="statistic">
|
||||||
|
<h3 class="statistic__description">
|
||||||
|
Anzahl von Lehrern erfasste Inhaltsblöcke
|
||||||
|
</h3>
|
||||||
|
<div class="statistic__value">
|
||||||
|
{{ content_block_by_teachers_count }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="statistic">
|
||||||
|
<h3 class="statistic__description">
|
||||||
|
Anzahl von Schülern erfasste Inhaltsblöcke
|
||||||
|
</h3>
|
||||||
|
<div class="statistic__value">
|
||||||
|
{{ content_block_by_students_count }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="statistic">
|
<div class="statistic">
|
||||||
|
|
@ -155,7 +171,7 @@
|
||||||
Wieviele Personen haben einen oder mehrere Inhaltsblöcke erfasst?
|
Wieviele Personen haben einen oder mehrere Inhaltsblöcke erfasst?
|
||||||
</h3>
|
</h3>
|
||||||
<div class="statistic__value">
|
<div class="statistic__value">
|
||||||
0
|
{{ users_with_content_blocks_count }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ from django.views.generic import TemplateView
|
||||||
from assignments.models import StudentSubmission
|
from assignments.models import StudentSubmission
|
||||||
from books.models import Module, ContentBlock
|
from books.models import Module, ContentBlock
|
||||||
from rooms.models import Room
|
from rooms.models import Room
|
||||||
from users.models import SchoolClass
|
from users.managers import RoleManager
|
||||||
|
from users.models import SchoolClass, User
|
||||||
|
|
||||||
|
|
||||||
class StatisticsView(TemplateView):
|
class StatisticsView(TemplateView):
|
||||||
|
|
@ -39,6 +40,19 @@ class StatisticsView(TemplateView):
|
||||||
|
|
||||||
content_block_count = ContentBlock.objects.count()
|
content_block_count = ContentBlock.objects.count()
|
||||||
|
|
||||||
|
content_block_by_users = ContentBlock.objects.filter(
|
||||||
|
Q(owner__user_roles__role__key=RoleManager.TEACHER_KEY) | Q(
|
||||||
|
owner__user_roles__role__key=RoleManager.STUDENT_KEY)).count()
|
||||||
|
|
||||||
|
content_block_by_teachers = ContentBlock.objects.filter(
|
||||||
|
owner__user_roles__role__key=RoleManager.TEACHER_KEY).count()
|
||||||
|
content_block_by_students = ContentBlock.objects.filter(
|
||||||
|
owner__user_roles__role__key=RoleManager.STUDENT_KEY).count()
|
||||||
|
|
||||||
|
users_with_content_blocks = User.objects.filter(
|
||||||
|
Q(user_roles__role__key=RoleManager.STUDENT_KEY) | Q(user_roles__role__key=RoleManager.TEACHER_KEY)).filter(
|
||||||
|
owned_pages__gt=0).distinct().count()
|
||||||
|
|
||||||
context['private_submissions'] = private_submissions
|
context['private_submissions'] = private_submissions
|
||||||
context['shared_submissions'] = shared_submissions
|
context['shared_submissions'] = shared_submissions
|
||||||
context['modules'] = modules
|
context['modules'] = modules
|
||||||
|
|
@ -47,5 +61,9 @@ class StatisticsView(TemplateView):
|
||||||
context['room_entries_classes'] = room_entries_classes
|
context['room_entries_classes'] = room_entries_classes
|
||||||
context['rooms'] = rooms
|
context['rooms'] = rooms
|
||||||
context['content_block_count'] = content_block_count
|
context['content_block_count'] = content_block_count
|
||||||
|
context['content_block_by_users_count'] = content_block_by_users
|
||||||
|
context['content_block_by_teachers_count'] = content_block_by_teachers
|
||||||
|
context['content_block_by_students_count'] = content_block_by_students
|
||||||
|
context['users_with_content_blocks_count'] = users_with_content_blocks
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue