WIP: Update schema

This commit is contained in:
Christian Cueni 2024-04-08 13:31:29 +02:00
parent 265bd01b79
commit d417cf5fe3
7 changed files with 18 additions and 40 deletions

View File

@ -23,7 +23,7 @@ const documents = {
"\n query courseQuery($slug: String!) {\n course(slug: $slug) {\n id\n title\n slug\n category_name\n configuration {\n id\n enable_circle_documents\n enable_learning_mentor\n enable_competence_certificates\n }\n action_competences {\n competence_id\n ...CoursePageFields\n performance_criteria {\n competence_id\n learning_unit {\n id\n slug\n evaluate_url\n }\n ...CoursePageFields\n }\n }\n learning_path {\n ...CoursePageFields\n topics {\n is_visible\n ...CoursePageFields\n circles {\n description\n goals\n ...CoursePageFields\n learning_sequences {\n icon\n ...CoursePageFields\n learning_units {\n evaluate_url\n ...CoursePageFields\n performance_criteria {\n ...CoursePageFields\n }\n learning_contents {\n can_user_self_toggle_course_completion\n content_url\n minutes\n description\n ...CoursePageFields\n ... on LearningContentAssignmentObjectType {\n assignment_type\n content_assignment {\n id\n assignment_type\n }\n competence_certificate {\n ...CoursePageFields\n }\n }\n ... on LearningContentEdoniqTestObjectType {\n checkbox_text\n has_extended_time_test\n content_assignment {\n id\n assignment_type\n }\n competence_certificate {\n ...CoursePageFields\n }\n }\n ... on LearningContentRichTextObjectType {\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n": types.CourseQueryDocument,
"\n query dashboardConfig {\n dashboard_config {\n id\n slug\n name\n dashboard_type\n course_configuration {\n id\n enable_circle_documents\n enable_learning_mentor\n enable_competence_certificates\n }\n }\n }\n": types.DashboardConfigDocument,
"\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n competence {\n _id\n total_count\n success_count\n fail_count\n }\n assignment {\n _id\n total_count\n points_max_count\n points_achieved_count\n }\n }\n }\n": types.DashboardProgressDocument,
"\n query dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n ui_config {\n _id\n role_key\n widgets\n has_preview\n }\n }\n }\n": types.DashboardCourseDataDocument,
"\n query dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n }\n }\n": types.DashboardCourseDataDocument,
"\n query courseStatistics($courseId: ID!) {\n course_statistics(course_id: $courseId) {\n _id\n course_id\n course_title\n course_slug\n course_session_properties {\n _id\n sessions {\n id\n name\n }\n generations\n circles {\n id\n name\n }\n }\n course_session_selection_ids\n course_session_selection_metrics {\n _id\n session_count\n participant_count\n expert_count\n }\n attendance_day_presences {\n _id\n records {\n _id\n course_session_id\n generation\n circle_id\n due_date\n participants_present\n participants_total\n details_url\n }\n summary {\n _id\n days_completed\n participants_present\n }\n }\n feedback_responses {\n _id\n records {\n _id\n course_session_id\n generation\n circle_id\n experts\n satisfaction_average\n satisfaction_max\n details_url\n }\n summary {\n _id\n satisfaction_average\n satisfaction_max\n total_responses\n }\n }\n assignments {\n _id\n summary {\n _id\n completed_count\n average_passed\n }\n records {\n _id\n course_session_id\n course_session_assignment_id\n circle_id\n generation\n assignment_title\n assignment_type_translation_key\n details_url\n deadline\n metrics {\n _id\n passed_count\n failed_count\n unranked_count\n ranking_completed\n average_passed\n }\n }\n }\n competences {\n _id\n summary {\n _id\n success_total\n fail_total\n }\n records {\n _id\n course_session_id\n generation\n circle_id\n title\n success_count\n fail_count\n details_url\n }\n }\n }\n }\n": types.CourseStatisticsDocument,
"\n mutation SendFeedbackMutation(\n $courseSessionId: ID!\n $learningContentId: ID!\n $learningContentType: String!\n $data: GenericScalar!\n $submitted: Boolean\n ) {\n send_feedback(\n course_session_id: $courseSessionId\n learning_content_page_id: $learningContentId\n learning_content_type: $learningContentType\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,
};
@ -85,7 +85,7 @@ export function graphql(source: "\n query dashboardProgress($courseId: ID!) {\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 dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n ui_config {\n _id\n role_key\n widgets\n has_preview\n }\n }\n }\n"): (typeof documents)["\n query dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n ui_config {\n _id\n role_key\n widgets\n has_preview\n }\n }\n }\n"];
export function graphql(source: "\n query dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\n }\n }\n"): (typeof documents)["\n query dashboardCourseData($courseId: ID!) {\n course_progress(course_id: $courseId) {\n _id\n course_id\n session_to_continue_id\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

@ -150,6 +150,8 @@ type AssignmentStatisticsSummaryType {
_id: ID!
completed_count: Int!
average_passed: Float!
total_passed: Int!
total_failed: Int!
}
type CompetencesStatisticsType {

View File

@ -75,7 +75,6 @@ export const PresenceRecordStatisticsType = "PresenceRecordStatisticsType";
export const ProgressDashboardAssignmentType = "ProgressDashboardAssignmentType";
export const ProgressDashboardCompetenceType = "ProgressDashboardCompetenceType";
export const Query = "Query";
export const RoleKeyType = "RoleKeyType";
export const SendFeedbackMutation = "SendFeedbackMutation";
export const StatisticsCircleDataType = "StatisticsCircleDataType";
export const StatisticsCourseSessionDataType = "StatisticsCourseSessionDataType";
@ -83,7 +82,5 @@ export const StatisticsCourseSessionPropertiesType = "StatisticsCourseSessionPro
export const StatisticsCourseSessionsSelectionMetricType = "StatisticsCourseSessionsSelectionMetricType";
export const String = "String";
export const TopicObjectType = "TopicObjectType";
export const UIConfigType = "UIConfigType";
export const UUID = "UUID";
export const UserObjectType = "UserObjectType";
export const WidgetType = "WidgetType";

View File

@ -337,12 +337,6 @@ export const DASHBOARD_COURSE_DATA = graphql(`
_id
course_id
session_to_continue_id
ui_config {
_id
role_key
widgets
has_preview
}
}
}
`);

View File

@ -42,6 +42,8 @@ class AssignmentStatisticsSummaryType(graphene.ObjectType):
_id = graphene.ID(required=True)
completed_count = graphene.Int(required=True)
average_passed = graphene.Float(required=True)
total_passed = graphene.Int(required=True)
total_failed = graphene.Int(required=True)
class AssignmentsStatisticsType(graphene.ObjectType):
@ -57,7 +59,7 @@ def create_assignment_summary(course_id, metrics) -> AssignmentStatisticsSummary
if not completed_metrics:
return AssignmentStatisticsSummaryType(
_id=course_id, completed_count=0, average_passed=0 # noqa
_id=course_id, completed_count=0, average_passed=0, total_passed=0, total_failed=0 # noqa
)
completed_count = len(completed_metrics)
@ -66,10 +68,15 @@ def create_assignment_summary(course_id, metrics) -> AssignmentStatisticsSummary
sum([m.average_passed for m in completed_metrics]) / completed_count
)
total_passed = sum([m.passed_count for m in completed_metrics])
total_failed = sum([m.failed_count for m in completed_metrics])
return AssignmentStatisticsSummaryType(
_id=course_id, # noqa
completed_count=completed_count, # noqa
average_passed=average_passed_completed, # noqa
total_passed=total_passed, # noqa
total_failed=total_failed, # noqa
)

View File

@ -79,7 +79,7 @@ class ProgressDashboardAssignmentType(graphene.ObjectType):
points_achieved_count = graphene.Int(required=True)
class CourseProgressType(graphene.ObjectType):
class öCourseProgressType(graphene.ObjectType):
_id = graphene.ID(required=True)
course_id = graphene.ID(required=True)
session_to_continue_id = graphene.ID(required=False)
@ -145,7 +145,7 @@ class CourseStatisticsType(graphene.ObjectType):
),
)
def resolve_assignments(root, info) -> AssignmentsStatisticsType:
def resolve_assignments(root, _info) -> AssignmentsStatisticsType:
user_selection_ids = (
[str(user) for user in root.user_selection_ids]
if root.user_selection_ids