Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9a080fc
Register UnitReportViewSet URL in coach api_urls
AllanOXDi Mar 17, 2026
5bea833
Add imports, shared constants, and _chunked helper for unit_report_api
AllanOXDi Mar 17, 2026
87b32cf
Add get_test_version and get_synthetic_content_id
AllanOXDi Mar 17, 2026
e026068
Add _get_test_status
AllanOXDi Mar 17, 2026
dceda22
Add _compute_all_test_scores
AllanOXDi Mar 17, 2026
d0bde15
Add UnitReportPermissions
AllanOXDi Mar 17, 2026
3106942
Add UnitReportViewSet
AllanOXDi Mar 17, 2026
86d322c
Add imports, shared fixtures, and test helpers for unit_report tests
AllanOXDi Mar 17, 2026
9432eda
Add GetTestVersionTests
AllanOXDi Mar 17, 2026
8c9195f
Add GetTestStatusTests
AllanOXDi Mar 17, 2026
0769922
Add ComputeTestScoresTests
AllanOXDi Mar 17, 2026
2e4b4c8
Add UnitReportAPIBase
AllanOXDi Mar 17, 2026
2e466b9
Add UnitReportPermissionTests
AllanOXDi Mar 17, 2026
d9320e8
Add UnitReportResponseShapeTests
AllanOXDi Mar 17, 2026
58b0395
Add UnitReportScoringTests
AllanOXDi Mar 17, 2026
158c869
Add UnitReportLearnerGroupTests
AllanOXDi Mar 17, 2026
1b17485
Replace ,is_active,status with closed field in unit_report_api
AllanOXDi Mar 19, 2026
84408b9
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 19, 2026
2edc679
Simplify the closed status check and more refactor
AllanOXDi Mar 19, 2026
0231559
fix rtibblesbot sugestion
AllanOXDi Mar 19, 2026
0c53668
Extract into a single authoritative module
AllanOXDi Mar 20, 2026
13e1ba5
add tests for mastery log edge cases
AllanOXDi Mar 20, 2026
7c9dfa5
remove user exclusion from learner list
AllanOXDi Mar 20, 2026
493f6cb
rename synthetic content ID namespace for clarity
AllanOXDi Mar 23, 2026
11a963d
Refactored UnitReportPermissions to use KolibriAuthPermissions.
AllanOXDi Mar 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions kolibri/core/logger/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import hashlib
import logging
import uuid as uuid_module
from datetime import timedelta
from itertools import groupby
from math import ceil
Expand Down Expand Up @@ -54,6 +53,7 @@
from kolibri.core.logger.constants.exercise_attempts import MAPPING
from kolibri.core.logger.evaluation import attempts_diff
from kolibri.core.logger.evaluation import LOG_ORDER_BY
from kolibri.core.logger.utils.pre_post_test import get_synthetic_content_id
from kolibri.core.notifications.api import create_summarylog
from kolibri.core.notifications.api import parse_attemptslog
from kolibri.core.notifications.api import parse_summarylog
Expand Down Expand Up @@ -389,10 +389,8 @@ def _get_context(self, user, validated_data):
"test_type": test_type,
}

# Synthetic content_id: UUID5 so pre and post are distinct
content_id = uuid_module.uuid5(
uuid_module.UUID(deterministic_hash), test_type
).hex
# Synthetic content_id: shared across all learners for this test instance.
content_id = get_synthetic_content_id(course_session_id, unit_id, test_type)
channel_id = None
kind = content_kinds.QUIZ

Expand Down
15 changes: 15 additions & 0 deletions kolibri/core/logger/utils/pre_post_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Single authoritative implementation of get_synthetic_content_id, shared between
the learner-side logger API (kolibri.core.logger.api) and the coach-side unit
report API (kolibri.plugins.coach.unit_report_api).
"""
import uuid

_PRE_POST_TEST_SYNTHETIC_CONTENT_ID_NAMESPACE = uuid.UUID(
"7c9e4b1a-3d5f-4a8e-9c2b-6d0e1f2a3b4c"
)


def get_synthetic_content_id(course_session_id, unit_id, test_type):
key = "{}:{}:{}".format(course_session_id, unit_id, test_type)
return uuid.uuid5(_PRE_POST_TEST_SYNTHETIC_CONTENT_ID_NAMESPACE, key).hex
10 changes: 9 additions & 1 deletion kolibri/plugins/coach/api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .api import PracticeQuizDifficultQuestionsViewset
from .api import QuizDifficultQuestionsViewset
from .class_summary_api import ClassSummaryViewSet
from .unit_report_api import UnitReportViewSet

router = routers.DefaultRouter()

Expand All @@ -30,4 +31,11 @@
basename="practicequizdifficulties",
)

urlpatterns = [re_path(r"^", include(router.urls))]
urlpatterns = [
re_path(r"^", include(router.urls)),
re_path(
r"^coursesession/(?P<course_session_id>[0-9a-fA-F]{32})/unit/(?P<unit_contentnode_id>[0-9a-fA-F]{32})/report/$",
UnitReportViewSet.as_view({"get": "retrieve"}),
name="unitreport",
),
]
Loading
Loading