Skip to content

Commit

Permalink
Merge pull request #12354 from nucleogenesis/fix--eqm-lesson-regressions
Browse files Browse the repository at this point in the history
EQM Lesson regression fixes
  • Loading branch information
rtibbles authored Jun 25, 2024
2 parents 5cd1f6a + 95602bb commit a946b7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kolibri/core/lessons/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def update(self, instance, validated_data):
# Update the scalar fields
instance.title = validated_data.get("title", instance.title)
instance.description = validated_data.get("description", instance.description)
instance.is_active = validated_data.get("active", instance.is_active)
instance.is_active = validated_data.get("is_active", instance.is_active)
instance.resources = validated_data.get("resources", instance.resources)

# Add/delete any new/removed Assignments
Expand Down
14 changes: 14 additions & 0 deletions kolibri/core/lessons/test/test_lesson_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,3 +529,17 @@ def test_can_get_lesson_size(self):
)

self.assertEqual(response.status_code, 200) # passing!

def test_can_update_lesson_active(self):
self.client.login(username=self.admin.username, password=DUMMY_PASSWORD)

response = self.client.patch(
reverse("kolibri:core:lesson-detail", kwargs={"pk": self.lesson.id}),
{
"active": False,
},
format="json",
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.lesson.refresh_from_db()
self.assertFalse(self.lesson.is_active)
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,22 @@ function _prepLessonContentPreview(store, classId, lessonId, contentId) {
getParams: { no_available_filtering: true },
}).then(
contentNode => {
const assessmentMetadata = contentNode.assessmentmetadata;
store.commit('lessonSummary/SET_STATE', {
toolbarRoute: {},
// only exist if exercises
workingResources: null,
resourceCache: cache,
});

store.commit('lessonSummary/resources/SET_CURRENT_CONTENT_NODE', contentNode);
store.commit('lessonSummary/resources/SET_PREVIEW_STATE', {
questions: assessmentMetadata.assessment_item_ids,
completionData: assessmentMetadata.mastery_model,
});

if (contentNode.assessmentmetadata) {
store.commit('lessonSummary/resources/SET_PREVIEW_STATE', {
questions: contentNode.assessmentmetadata.assessment_item_ids,
completionData: contentNode.assessmentmetadata.mastery_model,
});
}

store.commit('SET_PAGE_NAME', LessonsPageNames.CONTENT_PREVIEW);
return contentNode;
},
Expand Down

0 comments on commit a946b7c

Please sign in to comment.