diff --git a/client/src/components/dashboard/CoursePanel.vue b/client/src/components/dashboard/CoursePanel.vue index 82faeea2..a4926ed0 100644 --- a/client/src/components/dashboard/CoursePanel.vue +++ b/client/src/components/dashboard/CoursePanel.vue @@ -25,15 +25,18 @@ const data = ref(null); const courseSlug = computed(() => props.courseConfig?.slug); const courseName = computed(() => props.courseConfig?.name); const numberOfMentorWidgets = computed(() => { - return data.value?.widgets.filter((widget) => mentorWidgets.includes(widget)).length; + return data.value?.ui_config.widgets.filter((widget) => + mentorWidgets.includes(widget) + ).length; }); const numberOfProgressWidgets = computed(() => { - return data.value?.widgets.filter((widget) => progressWidgets.includes(widget)) - .length; + return data.value?.ui_config.widgets.filter((widget) => + progressWidgets.includes(widget) + ).length; }); function hasWidget(widget: WidgetType) { - return data.value?.widgets.includes(widget); + return data.value?.ui_config.widgets.includes(widget); } onMounted(async () => { @@ -46,6 +49,7 @@ onMounted(async () => {

{{ courseName }}

+

{{ data.ui_config.role_key }}

; course_id: Scalars['ID']['output']; session_to_continue_id?: Maybe; - widgets: Array; + ui_config?: Maybe; }; export type CourseSessionAssignmentObjectType = { @@ -453,6 +453,7 @@ export type CourseStatisticsType = { course_slug: Scalars['String']['output']; course_title: Scalars['String']['output']; feedback_responses: FeedbackStatisticsResponsesType; + user_selection_ids?: Maybe>>; }; export type DashboardConfigType = { @@ -922,6 +923,7 @@ export type Query = { learning_content_test?: Maybe; learning_content_video?: Maybe; learning_path?: Maybe; + mentor_course_statistics?: Maybe; }; @@ -987,6 +989,18 @@ export type QueryLearningPathArgs = { slug?: InputMaybe; }; + +export type QueryMentorCourseStatisticsArgs = { + course_id: Scalars['ID']['input']; +}; + +export type RoleKeyType = + | 'MEMBER' + | 'MENTOR_UK' + | 'MENTOR_VV' + | 'SUPERVISOR' + | 'TRAINER'; + export type SendFeedbackMutation = { __typename?: 'SendFeedbackMutation'; /** May contain more than one error for same field. */ @@ -1036,6 +1050,14 @@ export type TopicObjectType = CoursePageInterface & { translation_key: Scalars['String']['output']; }; +export type UiConfigType = { + __typename?: 'UIConfigType'; + _id: Scalars['ID']['output']; + has_preview?: Maybe; + role_key: RoleKeyType; + widgets: Array; +}; + export type UserObjectType = { __typename?: 'UserObjectType'; avatar_url?: Maybe; @@ -1295,7 +1317,7 @@ export type DashboardCourseDataQueryVariables = Exact<{ }>; -export type DashboardCourseDataQuery = { __typename?: 'Query', course_progress?: { __typename?: 'CourseProgressType', _id: string, course_id: string, session_to_continue_id?: string | null, widgets: Array } | null }; +export type DashboardCourseDataQuery = { __typename?: 'Query', course_progress?: { __typename?: 'CourseProgressType', _id: string, course_id: string, session_to_continue_id?: string | null, ui_config?: { __typename?: 'UIConfigType', _id: string, role_key: RoleKeyType, widgets: Array, has_preview?: boolean | null } | null } | null }; export type CourseStatisticsQueryVariables = Exact<{ courseId: Scalars['ID']['input']; @@ -1325,6 +1347,6 @@ export const CourseSessionDetailDocument = {"kind":"Document","definitions":[{"k export const CourseQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"courseQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"category_name"}},{"kind":"Field","name":{"kind":"Name","value":"configuration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enable_circle_documents"}},{"kind":"Field","name":{"kind":"Name","value":"enable_learning_mentor"}},{"kind":"Field","name":{"kind":"Name","value":"enable_competence_certificates"}}]}},{"kind":"Field","name":{"kind":"Name","value":"action_competences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"competence_id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"performance_criteria"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"competence_id"}},{"kind":"Field","name":{"kind":"Name","value":"learning_unit"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"evaluate_url"}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"learning_path"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"topics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"is_visible"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"circles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"goals"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"learning_sequences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"learning_units"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evaluate_url"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"Field","name":{"kind":"Name","value":"performance_criteria"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"learning_contents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"can_user_self_toggle_course_completion"}},{"kind":"Field","name":{"kind":"Name","value":"content_url"}},{"kind":"Field","name":{"kind":"Name","value":"minutes"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LearningContentAssignmentObjectType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignment_type"}},{"kind":"Field","name":{"kind":"Name","value":"content_assignment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"assignment_type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"competence_certificate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LearningContentEdoniqTestObjectType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"checkbox_text"}},{"kind":"Field","name":{"kind":"Name","value":"has_extended_time_test"}},{"kind":"Field","name":{"kind":"Name","value":"content_assignment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"assignment_type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"competence_certificate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoursePageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LearningContentRichTextObjectType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}}]}}]}}]}}]}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoursePageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CoursePageInterface"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"content_type"}},{"kind":"Field","name":{"kind":"Name","value":"frontend_url"}}]}}]} as unknown as DocumentNode; export const DashboardConfigDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"dashboardConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"dashboard_config"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"dashboard_type"}},{"kind":"Field","name":{"kind":"Name","value":"course_configuration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enable_circle_documents"}},{"kind":"Field","name":{"kind":"Name","value":"enable_learning_mentor"}},{"kind":"Field","name":{"kind":"Name","value":"enable_competence_certificates"}}]}}]}}]}}]} as unknown as DocumentNode; export const DashboardProgressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"dashboardProgress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course_progress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"course_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_id"}},{"kind":"Field","name":{"kind":"Name","value":"session_to_continue_id"}},{"kind":"Field","name":{"kind":"Name","value":"competence"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"total_count"}},{"kind":"Field","name":{"kind":"Name","value":"success_count"}},{"kind":"Field","name":{"kind":"Name","value":"fail_count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assignment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"total_count"}},{"kind":"Field","name":{"kind":"Name","value":"points_max_count"}},{"kind":"Field","name":{"kind":"Name","value":"points_achieved_count"}}]}}]}}]}}]} as unknown as DocumentNode; -export const DashboardCourseDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"dashboardCourseData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course_progress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"course_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_id"}},{"kind":"Field","name":{"kind":"Name","value":"session_to_continue_id"}},{"kind":"Field","name":{"kind":"Name","value":"widgets"}}]}}]}}]} as unknown as DocumentNode; +export const DashboardCourseDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"dashboardCourseData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course_progress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"course_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_id"}},{"kind":"Field","name":{"kind":"Name","value":"session_to_continue_id"}},{"kind":"Field","name":{"kind":"Name","value":"ui_config"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"role_key"}},{"kind":"Field","name":{"kind":"Name","value":"widgets"}},{"kind":"Field","name":{"kind":"Name","value":"has_preview"}}]}}]}}]}}]} as unknown as DocumentNode; export const CourseStatisticsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"courseStatistics"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"course_statistics"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"course_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_title"}},{"kind":"Field","name":{"kind":"Name","value":"course_slug"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"sessions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"generations"}},{"kind":"Field","name":{"kind":"Name","value":"circles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"course_session_selection_ids"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_selection_metrics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"session_count"}},{"kind":"Field","name":{"kind":"Name","value":"participant_count"}},{"kind":"Field","name":{"kind":"Name","value":"expert_count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attendance_day_presences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_id"}},{"kind":"Field","name":{"kind":"Name","value":"generation"}},{"kind":"Field","name":{"kind":"Name","value":"circle_id"}},{"kind":"Field","name":{"kind":"Name","value":"due_date"}},{"kind":"Field","name":{"kind":"Name","value":"participants_present"}},{"kind":"Field","name":{"kind":"Name","value":"participants_total"}},{"kind":"Field","name":{"kind":"Name","value":"details_url"}}]}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"days_completed"}},{"kind":"Field","name":{"kind":"Name","value":"participants_present"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"feedback_responses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_id"}},{"kind":"Field","name":{"kind":"Name","value":"generation"}},{"kind":"Field","name":{"kind":"Name","value":"circle_id"}},{"kind":"Field","name":{"kind":"Name","value":"experts"}},{"kind":"Field","name":{"kind":"Name","value":"satisfaction_average"}},{"kind":"Field","name":{"kind":"Name","value":"satisfaction_max"}},{"kind":"Field","name":{"kind":"Name","value":"details_url"}}]}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"satisfaction_average"}},{"kind":"Field","name":{"kind":"Name","value":"satisfaction_max"}},{"kind":"Field","name":{"kind":"Name","value":"total_responses"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"assignments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"completed_count"}},{"kind":"Field","name":{"kind":"Name","value":"average_passed"}}]}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_assignment_id"}},{"kind":"Field","name":{"kind":"Name","value":"circle_id"}},{"kind":"Field","name":{"kind":"Name","value":"generation"}},{"kind":"Field","name":{"kind":"Name","value":"assignment_title"}},{"kind":"Field","name":{"kind":"Name","value":"assignment_type_translation_key"}},{"kind":"Field","name":{"kind":"Name","value":"details_url"}},{"kind":"Field","name":{"kind":"Name","value":"deadline"}},{"kind":"Field","name":{"kind":"Name","value":"metrics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"passed_count"}},{"kind":"Field","name":{"kind":"Name","value":"failed_count"}},{"kind":"Field","name":{"kind":"Name","value":"unranked_count"}},{"kind":"Field","name":{"kind":"Name","value":"ranking_completed"}},{"kind":"Field","name":{"kind":"Name","value":"average_passed"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"competences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"success_total"}},{"kind":"Field","name":{"kind":"Name","value":"fail_total"}}]}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"_id"}},{"kind":"Field","name":{"kind":"Name","value":"course_session_id"}},{"kind":"Field","name":{"kind":"Name","value":"generation"}},{"kind":"Field","name":{"kind":"Name","value":"circle_id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"success_count"}},{"kind":"Field","name":{"kind":"Name","value":"fail_count"}},{"kind":"Field","name":{"kind":"Name","value":"details_url"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const SendFeedbackMutationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendFeedbackMutation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"learningContentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"learningContentType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"GenericScalar"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"submitted"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"send_feedback"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"course_session_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"courseSessionId"}}},{"kind":"Argument","name":{"kind":"Name","value":"learning_content_page_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"learningContentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"learning_content_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"learningContentType"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}},{"kind":"Argument","name":{"kind":"Name","value":"submitted"},"value":{"kind":"Variable","name":{"kind":"Name","value":"submitted"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"feedback_response"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"submitted"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"Field","name":{"kind":"Name","value":"messages"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/client/src/gql/schema.graphql b/client/src/gql/schema.graphql index fafe2c15..cb6827be 100644 --- a/client/src/gql/schema.graphql +++ b/client/src/gql/schema.graphql @@ -1,5 +1,6 @@ type Query { course_statistics(course_id: ID!): CourseStatisticsType + mentor_course_statistics(course_id: ID!): CourseStatisticsType course_progress(course_id: ID!): CourseProgressType dashboard_config: [DashboardConfigType!]! learning_path(id: ID, slug: String, course_id: ID, course_slug: String): LearningPathObjectType @@ -31,6 +32,7 @@ type CourseStatisticsType { course_slug: String! course_session_properties: StatisticsCourseSessionPropertiesType! course_session_selection_ids: [ID]! + user_selection_ids: [ID] course_session_selection_metrics: StatisticsCourseSessionsSelectionMetricType! attendance_day_presences: AttendanceDayPresencesStatisticsType! feedback_responses: FeedbackStatisticsResponsesType! @@ -179,7 +181,7 @@ type CourseProgressType { session_to_continue_id: ID competence: ProgressDashboardCompetenceType assignment: ProgressDashboardAssignmentType - widgets: [WidgetType!]! + ui_config: UIConfigType } type ProgressDashboardCompetenceType { @@ -196,6 +198,21 @@ type ProgressDashboardAssignmentType { points_achieved_count: Int! } +type UIConfigType { + _id: ID! + role_key: RoleKeyType! + widgets: [WidgetType!]! + has_preview: Boolean +} + +enum RoleKeyType { + MEMBER + MENTOR_VV + MENTOR_UK + SUPERVISOR + TRAINER +} + enum WidgetType { PROGRESS_WIDGET COMPETENCE_WIDGET diff --git a/client/src/gql/typenames.ts b/client/src/gql/typenames.ts index 732cb885..026956b6 100644 --- a/client/src/gql/typenames.ts +++ b/client/src/gql/typenames.ts @@ -75,6 +75,7 @@ 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"; @@ -82,6 +83,7 @@ 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"; diff --git a/client/src/graphql/queries.ts b/client/src/graphql/queries.ts index 15dc2766..29f174da 100644 --- a/client/src/graphql/queries.ts +++ b/client/src/graphql/queries.ts @@ -337,7 +337,12 @@ export const DASHBOARD_COURSE_DATA = graphql(` _id course_id session_to_continue_id - widgets + ui_config { + _id + role_key + widgets + has_preview + } } } `); diff --git a/client/src/pages/dashboard/DashboardPage.vue b/client/src/pages/dashboard/DashboardPage.vue index 6031c402..8d57ac50 100644 --- a/client/src/pages/dashboard/DashboardPage.vue +++ b/client/src/pages/dashboard/DashboardPage.vue @@ -64,7 +64,7 @@ onMounted(dashboardStore.loadDashboardDetails); dashboardStore.currentDashboardConfig.dashboard_type === 'PRAXISBILDNER_DASHBOARD' " - course-config="dashboardStore.currentDashboardConfig" + :course-config="dashboardStore.currentDashboardConfig" /> AssignmentStatisticsSummary def get_assignment_completion_metrics( - course_session: CourseSession, assignment: vbv_lernwelt.assignment.models.Assignment + course_session: CourseSession, assignment: vbv_lernwelt.assignment.models.Assignment, + user_selection_ids: List[str] | None ) -> AssignmentCompletionMetricsType: course_session_users = CourseSessionUser.objects.filter( course_session=course_session, @@ -111,6 +112,7 @@ def get_assignment_completion_metrics( def create_record( course_session_assignment: CourseSessionAssignment | CourseSessionEdoniqTest, + user_selection_ids: List[str] | None ) -> AssignmentStatisticsRecordType: if isinstance(course_session_assignment, CourseSessionAssignment): due_date = course_session_assignment.submission_deadline @@ -133,6 +135,7 @@ def create_record( metrics=get_assignment_completion_metrics( # noqa course_session=course_session_assignment.course_session, # noqa assignment=learning_content.content_assignment, # noqa + user_selection_ids=user_selection_ids, # noqa ), details_url=due_date.url_expert, # noqa deadline=due_date.start, # noqa @@ -142,6 +145,7 @@ def create_record( def assignments( course_id: graphene.ID(required=True), course_session_selection_ids: graphene.List(graphene.ID), + user_selection_ids: List[str] | None = None, ) -> AssignmentsStatisticsType: course_sessions = CourseSession.objects.filter( id__in=course_session_selection_ids, @@ -156,14 +160,14 @@ def assignments( ], learning_content__content_assignment__competence_certificate__isnull=False, ): - record = create_record(course_session_assignment=csa) + record = create_record(course_session_assignment=csa, user_selection_ids=user_selection_ids) records.append(record) for cset in CourseSessionEdoniqTest.objects.filter( course_session=course_session, learning_content__content_assignment__competence_certificate__isnull=False, ): - record = create_record(course_session_assignment=cset) + record = create_record(course_session_assignment=cset, user_selection_ids=user_selection_ids) records.append(record) return AssignmentsStatisticsType( diff --git a/server/vbv_lernwelt/dashboard/graphql/types/dashboard.py b/server/vbv_lernwelt/dashboard/graphql/types/dashboard.py index c070bc7d..38da733a 100644 --- a/server/vbv_lernwelt/dashboard/graphql/types/dashboard.py +++ b/server/vbv_lernwelt/dashboard/graphql/types/dashboard.py @@ -8,6 +8,7 @@ from vbv_lernwelt.assignment.models import ( AssignmentCompletionStatus, ) from vbv_lernwelt.core.models import User +from vbv_lernwelt.course.consts import UK_COURSE_IDS from vbv_lernwelt.course.graphql.types import CourseConfigurationObjectType from vbv_lernwelt.course.models import Course, CourseSession, CourseSessionUser from vbv_lernwelt.dashboard.graphql.types.assignment import ( @@ -78,6 +79,14 @@ class WidgetType(Enum): COMPETENCE_CERTIFICATE_WIDGET = "CompetenceCertificateWidget" +class RoleKeyType(Enum): + MEMBER = "Member" + MENTOR_VV = "MentorVV" + MENTOR_UK = "MentorUK" + SUPERVISOR = "Supervisor" + TRAINER = "Trainer" + + class DashboardConfigType(graphene.ObjectType): id = graphene.ID(required=True) name = graphene.String(required=True) @@ -86,11 +95,6 @@ class DashboardConfigType(graphene.ObjectType): course_configuration = graphene.Field(CourseConfigurationObjectType, required=True) -class DashboardDataType(graphene.ObjectType): - id = graphene.ID(required=True) - widgets = graphene.List(graphene.NonNull(WidgetType), required=True) - - class ProgressDashboardCompetenceType(graphene.ObjectType): _id = graphene.ID(required=True) total_count = graphene.Int(required=True) @@ -105,13 +109,20 @@ class ProgressDashboardAssignmentType(graphene.ObjectType): points_achieved_count = graphene.Int(required=True) +class UIConfigType(graphene.ObjectType): + _id = graphene.ID(required=True) + role_key = graphene.Field(RoleKeyType, required=True) + widgets = graphene.List(graphene.NonNull(WidgetType), required=True) + has_preview = graphene.Boolean(required=False) + + class CourseProgressType(graphene.ObjectType): _id = graphene.ID(required=True) course_id = graphene.ID(required=True) session_to_continue_id = graphene.ID(required=False) competence = graphene.Field(ProgressDashboardCompetenceType, required=False) assignment = graphene.Field(ProgressDashboardAssignmentType, required=False) - widgets = graphene.List(graphene.NonNull(WidgetType), required=True) + ui_config = graphene.Field(UIConfigType, required=False) def resolve__id(root, info): return info.context.course.id @@ -163,8 +174,8 @@ class CourseProgressType(graphene.ObjectType): fail_count=fail_total, # noqa ) - def resolve_widgets(root, info): - return get_widgets_for_course(info.context.course, info.context.user) + def resolve_ui_config(root, info): + return get_ui_config_for_course(info.context.course, info.context.user) def _get_newest_cs_and_cs_for_user( root, info, course_id: str, user: User @@ -203,6 +214,7 @@ class CourseStatisticsType(graphene.ObjectType): StatisticsCourseSessionPropertiesType, required=True ) course_session_selection_ids = graphene.List(graphene.ID, required=True) + user_selection_ids = graphene.List(graphene.ID, required=False) course_session_selection_metrics = graphene.Field( StatisticsCourseSessionsSelectionMetricType, required=True ) @@ -229,11 +241,14 @@ class CourseStatisticsType(graphene.ObjectType): ) def resolve_competences(root, info) -> CompetencesStatisticsType: + user_selection_ids = [str(user) for user in + root.user_selection_ids] if root.user_selection_ids else None # noqa records, success_total, fail_total = competences( course_slug=str(root.course_slug), course_session_selection_ids=[ str(cs) for cs in root.course_session_selection_ids # noqa ], + user_selection_ids=user_selection_ids, # noqa ) return CompetencesStatisticsType( _id=root._id, # noqa @@ -246,9 +261,12 @@ class CourseStatisticsType(graphene.ObjectType): ) def resolve_assignments(root, info) -> AssignmentsStatisticsType: + user_selection_ids = [str(user) for user in + root.user_selection_ids] if root.user_selection_ids else None # noqa return assignments( course_id=root.course_id, course_session_selection_ids=root.course_session_selection_ids, + user_selection_ids=user_selection_ids, ) def resolve_course_session_selection_metrics( @@ -320,8 +338,10 @@ class CourseStatisticsType(graphene.ObjectType): ) -def get_widgets_for_course(course: Course, user: User) -> List[WidgetType]: +def get_ui_config_for_course(course: Course, user: User) -> UIConfigType: widgets = [] + role_key = None + has_preview = False course_sessions = CourseSession.objects.filter( course__id=course.id, coursesessionuser__user=user @@ -346,20 +366,32 @@ def get_widgets_for_course(course: Course, user: User) -> List[WidgetType]: roles_by_course.setdefault(course_session.course, set()) roles_by_course[course_session.course].add(role) + # todo: use permissions for course, roles in roles_by_course.items(): if len(roles) == 1: course_role = roles.pop() # members if course_role == CourseSessionUser.Role.MEMBER: + role_key = RoleKeyType.MEMBER widgets.append(WidgetType.PROGRESS_WIDGET) widgets.append(WidgetType.COMPETENCE_WIDGET) if course.configuration.enable_competence_certificates: widgets.append(WidgetType.COMPETENCE_CERTIFICATE_WIDGET) # mentors if course.id in mentor_course_ids: + if not role_key: + role_key = RoleKeyType.MENTOR_UK if course.id in UK_COURSE_IDS else RoleKeyType.MENTOR_VV + has_preview = True widgets.append(WidgetType.MENTOR_TASKS_WIDGET) widgets.append(WidgetType.MENTOR_PERSON_WIDGET) if course.configuration.enable_competence_certificates: widgets.append(WidgetType.MENTOR_COMPETENCE_WIDGET) - return widgets + + # todo: supervisors + return UIConfigType( + _id=f"{course.id}_{user.id}", # noqa + role_key=role_key, # noqa, + widgets=widgets, # noqa + has_preview=has_preview, # noqa + )