Add first basic LEARNING_PATH_QUERY

This commit is contained in:
Daniel Egger 2023-10-11 17:26:46 +02:00
parent 99508fec09
commit 6510d74549
6 changed files with 227 additions and 51 deletions

View File

@ -19,8 +19,9 @@ const documents = {
"\n query attendanceCheckQuery($courseSessionId: ID!) {\n course_session_attendance_course(id: $courseSessionId) {\n id\n attendance_user_list {\n user_id\n status\n }\n }\n }\n": types.AttendanceCheckQueryDocument,
"\n query assignmentCompletionQuery(\n $assignmentId: ID!\n $courseSessionId: ID!\n $learningContentId: ID\n $assignmentUserId: UUID\n ) {\n assignment(id: $assignmentId) {\n assignment_type\n needs_expert_evaluation\n max_points\n content_type\n effort_required\n evaluation_description\n evaluation_document_url\n evaluation_tasks\n id\n intro_text\n performance_objectives\n slug\n tasks\n title\n translation_key\n competence_certificate {\n ...CoursePageFields\n }\n }\n assignment_completion(\n assignment_id: $assignmentId\n course_session_id: $courseSessionId\n assignment_user_id: $assignmentUserId\n learning_content_page_id: $learningContentId\n ) {\n id\n completion_status\n submitted_at\n evaluation_submitted_at\n evaluation_user {\n id\n }\n assignment_user {\n id\n }\n evaluation_points\n evaluation_max_points\n evaluation_passed\n edoniq_extended_time_flag\n completion_data\n task_completion_data\n }\n }\n": types.AssignmentCompletionQueryDocument,
"\n query courseQuery($courseId: ID!) {\n course(id: $courseId) {\n id\n slug\n title\n category_name\n learning_path {\n id\n }\n }\n }\n": types.CourseQueryDocument,
"\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n title\n id\n slug\n content_type\n frontend_url\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n": types.CompetenceCertificateQueryDocument,
"\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n ...CoursePageFields\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n": types.CompetenceCertificateQueryDocument,
"\n query courseSessionDetail($courseSessionId: ID!) {\n course_session(id: $courseSessionId) {\n id\n title\n course {\n id\n title\n slug\n }\n users {\n id\n user_id\n first_name\n last_name\n email\n avatar_url\n role\n circles {\n id\n title\n slug\n }\n }\n attendance_courses {\n id\n location\n trainer\n due_date {\n id\n start\n end\n }\n learning_content_id\n learning_content {\n id\n title\n circle {\n id\n title\n slug\n }\n }\n }\n assignments {\n id\n submission_deadline {\n id\n start\n }\n evaluation_deadline {\n id\n start\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n edoniq_tests {\n id\n deadline {\n id\n start\n end\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n }\n }\n": types.CourseSessionDetailDocument,
"\n query learningPathQuery($slug: String!) {\n learning_path(slug: $slug) {\n ...CoursePageFields\n topics {\n is_visible\n ...CoursePageFields\n circles {\n ...CoursePageFields\n learning_sequences {\n icon\n ...CoursePageFields\n learning_units {\n evaluate_url\n ...CoursePageFields\n learning_contents {\n ...CoursePageFields\n ... on LearningContentAssignmentObjectType {\n assignment_type\n content_assignment {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n": types.LearningPathQueryDocument,
"\n mutation SendFeedbackMutation(\n $courseSessionId: ID!\n $learningContentId: ID!\n $data: GenericScalar!\n $submitted: Boolean\n ) {\n send_feedback(\n course_session_id: $courseSessionId\n learning_content_page_id: $learningContentId\n data: $data\n submitted: $submitted\n ) {\n feedback_response {\n id\n data\n submitted\n }\n errors {\n field\n messages\n }\n }\n }\n": types.SendFeedbackMutationDocument,
};
@ -65,11 +66,15 @@ export function graphql(source: "\n query courseQuery($courseId: ID!) {\n co
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n title\n id\n slug\n content_type\n frontend_url\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n title\n id\n slug\n content_type\n frontend_url\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n"];
export function graphql(source: "\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n ...CoursePageFields\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query competenceCertificateQuery($courseSlug: String!, $courseSessionId: ID!) {\n competence_certificate_list(course_slug: $courseSlug) {\n ...CoursePageFields\n competence_certificates {\n ...CoursePageFields\n assignments {\n ...CoursePageFields\n assignment_type\n max_points\n completion(course_session_id: $courseSessionId) {\n id\n completion_status\n submitted_at\n evaluation_points\n evaluation_max_points\n evaluation_passed\n }\n learning_content {\n ...CoursePageFields\n circle {\n ...CoursePageFields\n }\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query courseSessionDetail($courseSessionId: ID!) {\n course_session(id: $courseSessionId) {\n id\n title\n course {\n id\n title\n slug\n }\n users {\n id\n user_id\n first_name\n last_name\n email\n avatar_url\n role\n circles {\n id\n title\n slug\n }\n }\n attendance_courses {\n id\n location\n trainer\n due_date {\n id\n start\n end\n }\n learning_content_id\n learning_content {\n id\n title\n circle {\n id\n title\n slug\n }\n }\n }\n assignments {\n id\n submission_deadline {\n id\n start\n }\n evaluation_deadline {\n id\n start\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n edoniq_tests {\n id\n deadline {\n id\n start\n end\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query courseSessionDetail($courseSessionId: ID!) {\n course_session(id: $courseSessionId) {\n id\n title\n course {\n id\n title\n slug\n }\n users {\n id\n user_id\n first_name\n last_name\n email\n avatar_url\n role\n circles {\n id\n title\n slug\n }\n }\n attendance_courses {\n id\n location\n trainer\n due_date {\n id\n start\n end\n }\n learning_content_id\n learning_content {\n id\n title\n circle {\n id\n title\n slug\n }\n }\n }\n assignments {\n id\n submission_deadline {\n id\n start\n }\n evaluation_deadline {\n id\n start\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n edoniq_tests {\n id\n deadline {\n id\n start\n end\n }\n learning_content {\n id\n title\n content_assignment {\n id\n title\n assignment_type\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query learningPathQuery($slug: String!) {\n learning_path(slug: $slug) {\n ...CoursePageFields\n topics {\n is_visible\n ...CoursePageFields\n circles {\n ...CoursePageFields\n learning_sequences {\n icon\n ...CoursePageFields\n learning_units {\n evaluate_url\n ...CoursePageFields\n learning_contents {\n ...CoursePageFields\n ... on LearningContentAssignmentObjectType {\n assignment_type\n content_assignment {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query learningPathQuery($slug: String!) {\n learning_path(slug: $slug) {\n ...CoursePageFields\n topics {\n is_visible\n ...CoursePageFields\n circles {\n ...CoursePageFields\n learning_sequences {\n icon\n ...CoursePageFields\n learning_units {\n evaluate_url\n ...CoursePageFields\n learning_contents {\n ...CoursePageFields\n ... on LearningContentAssignmentObjectType {\n assignment_type\n content_assignment {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/

File diff suppressed because one or more lines are too long

View File

@ -124,6 +124,7 @@ type LearningUnitObjectType implements CoursePageInterface {
circle: CircleObjectType
course: CourseObjectType
learning_contents: [LearningContentInterface]
evaluate_url: String
}
interface LearningContentInterface {
@ -193,7 +194,7 @@ type TopicObjectType implements CoursePageInterface {
circles: [CircleObjectType]
}
type LearningContentMediaLibraryObjectType implements LearningContentInterface {
type LearningContentMediaLibraryObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -208,7 +209,7 @@ type LearningContentMediaLibraryObjectType implements LearningContentInterface {
content: String
}
type LearningContentAssignmentObjectType implements LearningContentInterface {
type LearningContentAssignmentObjectType implements CoursePageInterface & LearningContentInterface {
content_assignment: AssignmentObjectType!
assignment_type: LearnpathLearningContentAssignmentAssignmentTypeChoices!
id: ID
@ -349,7 +350,7 @@ type CourseSessionAttendanceCourseObjectType {
attendance_user_list: [AttendanceUserObjectType]
}
type LearningContentAttendanceCourseObjectType implements LearningContentInterface {
type LearningContentAttendanceCourseObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -428,7 +429,7 @@ type CourseSessionEdoniqTestObjectType {
learning_content_id: ID
}
type LearningContentEdoniqTestObjectType implements LearningContentInterface {
type LearningContentEdoniqTestObjectType implements CoursePageInterface & LearningContentInterface {
content_assignment: AssignmentObjectType
id: ID
title: String
@ -518,7 +519,7 @@ enum LearnpathLearningContentAssignmentAssignmentTypeChoices {
EDONIQ_TEST
}
type LearningContentFeedbackObjectType implements LearningContentInterface {
type LearningContentFeedbackObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -533,7 +534,7 @@ type LearningContentFeedbackObjectType implements LearningContentInterface {
content: String
}
type LearningContentLearningModuleObjectType implements LearningContentInterface {
type LearningContentLearningModuleObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -548,7 +549,7 @@ type LearningContentLearningModuleObjectType implements LearningContentInterface
content: String
}
type LearningContentPlaceholderObjectType implements LearningContentInterface {
type LearningContentPlaceholderObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -563,7 +564,7 @@ type LearningContentPlaceholderObjectType implements LearningContentInterface {
content: String
}
type LearningContentRichTextObjectType implements LearningContentInterface {
type LearningContentRichTextObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -578,7 +579,7 @@ type LearningContentRichTextObjectType implements LearningContentInterface {
content: String
}
type LearningContentVideoObjectType implements LearningContentInterface {
type LearningContentVideoObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String
@ -593,7 +594,7 @@ type LearningContentVideoObjectType implements LearningContentInterface {
content: String
}
type LearningContentDocumentListObjectType implements LearningContentInterface {
type LearningContentDocumentListObjectType implements CoursePageInterface & LearningContentInterface {
id: ID
title: String
slug: String

View File

@ -109,11 +109,7 @@ export const COMPETENCE_NAVI_CERTIFICATE_QUERY = graphql(`
evaluation_passed
}
learning_content {
title
id
slug
content_type
frontend_url
...CoursePageFields
circle {
...CoursePageFields
}
@ -208,3 +204,35 @@ export const COURSE_SESSION_DETAIL_QUERY = graphql(`
}
}
`);
export const LEARNING_PATH_QUERY = graphql(`
query learningPathQuery($slug: String!) {
learning_path(slug: $slug) {
...CoursePageFields
topics {
is_visible
...CoursePageFields
circles {
...CoursePageFields
learning_sequences {
icon
...CoursePageFields
learning_units {
evaluate_url
...CoursePageFields
learning_contents {
...CoursePageFields
... on LearningContentAssignmentObjectType {
assignment_type
content_assignment {
id
}
}
}
}
}
}
}
}
}
`);

View File

@ -63,49 +63,70 @@ class LearningContentInterface(CoursePageInterface):
class LearningContentAttendanceCourseObjectType(DjangoObjectType):
class Meta:
model = LearningContentAttendanceCourse
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentVideoObjectType(DjangoObjectType):
class Meta:
model = LearningContentVideo
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentPlaceholderObjectType(DjangoObjectType):
class Meta:
model = LearningContentPlaceholder
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentFeedbackObjectType(DjangoObjectType):
class Meta:
model = LearningContentFeedback
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentLearningModuleObjectType(DjangoObjectType):
class Meta:
model = LearningContentLearningModule
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentMediaLibraryObjectType(DjangoObjectType):
class Meta:
model = LearningContentMediaLibrary
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentEdoniqTestObjectType(DjangoObjectType):
class Meta:
model = LearningContentEdoniqTest
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = [
"content_assignment",
]
@ -114,14 +135,20 @@ class LearningContentEdoniqTestObjectType(DjangoObjectType):
class LearningContentRichTextObjectType(DjangoObjectType):
class Meta:
model = LearningContentRichText
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningContentAssignmentObjectType(DjangoObjectType):
class Meta:
model = LearningContentAssignment
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = [
"content_assignment",
"assignment_type",
@ -131,17 +158,25 @@ class LearningContentAssignmentObjectType(DjangoObjectType):
class LearningContentDocumentListObjectType(DjangoObjectType):
class Meta:
model = LearningContentDocumentList
interfaces = (LearningContentInterface,)
interfaces = (
CoursePageInterface,
LearningContentInterface,
)
fields = []
class LearningUnitObjectType(DjangoObjectType):
learning_contents = graphene.List(LearningContentInterface)
evaluate_url = graphene.String()
class Meta:
model = LearningUnit
interfaces = (CoursePageInterface,)
fields = []
fields = ["evaluate_url"]
@staticmethod
def resolve_evaluate_url(root: LearningUnit, info, **kwargs):
return root.get_evaluate_url()
@staticmethod
def resolve_learning_contents(root: LearningUnit, info, **kwargs):

View File

@ -58,6 +58,9 @@ class Topic(CourseBasePage):
def get_admin_display_title(self):
return f"Thema: {self.draft_title}"
def get_frontend_url(self):
return ""
class Meta:
verbose_name = "Topic"