chore: add _id field
This commit is contained in:
parent
0f80fe5104
commit
0ecb03275e
|
|
@ -22,7 +22,7 @@ const 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": types.CourseSessionDetailDocument,
|
||||
"\n query courseQuery($slug: String!) {\n course(slug: $slug) {\n id\n title\n slug\n category_name\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 }\n competence_certificate {\n ...CoursePageFields\n }\n }\n ... on LearningContentEdoniqTestObjectType {\n checkbox_text\n has_extended_time_test\n content_assignment {\n id\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 }\n }\n": types.DashboardConfigDocument,
|
||||
"\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n id\n session_to_continue_id\n }\n }\n": types.DashboardProgressDocument,
|
||||
"\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n 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 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,
|
||||
};
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ export function graphql(source: "\n query dashboardConfig {\n dashboard_conf
|
|||
/**
|
||||
* 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 dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n id\n session_to_continue_id\n }\n }\n"): (typeof documents)["\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n id\n session_to_continue_id\n }\n }\n"];
|
||||
export function graphql(source: "\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n 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"): (typeof documents)["\n query dashboardProgress($courseId: ID!) {\n course_progress(course_id: $courseId) {\n 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"];
|
||||
/**
|
||||
* 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
|
|
@ -25,6 +25,7 @@ type Query {
|
|||
type CourseStatisticsType {
|
||||
id: ID!
|
||||
course_title: String!
|
||||
course_slug: String!
|
||||
course_session_properties: CourseSessionProperties!
|
||||
course_session_selection_ids: [ID]!
|
||||
course_session_selection_metrics: CourseSessionsSelectionMetrics!
|
||||
|
|
@ -69,7 +70,7 @@ type PresenceRecord {
|
|||
due_date: String!
|
||||
participants_present: Int!
|
||||
participants_total: Int!
|
||||
cockpit_url: String!
|
||||
details_url: String!
|
||||
}
|
||||
|
||||
type AttendanceSummary {
|
||||
|
|
@ -88,6 +89,7 @@ type FeedbackRecord {
|
|||
circle_id: ID!
|
||||
satisfaction_average: Float!
|
||||
satisfaction_max: Int!
|
||||
details_url: String!
|
||||
}
|
||||
|
||||
type FeedbackSummary {
|
||||
|
|
@ -144,6 +146,7 @@ type CompetencePerformance {
|
|||
circle_id: ID!
|
||||
success_count: Int!
|
||||
fail_count: Int!
|
||||
details_url: String!
|
||||
}
|
||||
|
||||
type CompletionSummary {
|
||||
|
|
@ -153,7 +156,23 @@ type CompletionSummary {
|
|||
|
||||
type CourseProgressType {
|
||||
id: ID!
|
||||
session_to_continue_id: ID!
|
||||
session_to_continue_id: ID
|
||||
competence: ProgressDashboardCompetenceType!
|
||||
assignment: ProgressDashboardAssignmentType!
|
||||
}
|
||||
|
||||
type ProgressDashboardCompetenceType {
|
||||
_id: ID!
|
||||
total_count: Int!
|
||||
success_count: Int!
|
||||
fail_count: Int!
|
||||
}
|
||||
|
||||
type ProgressDashboardAssignmentType {
|
||||
_id: ID!
|
||||
total_count: Int!
|
||||
points_max_count: Int!
|
||||
points_achieved_count: Int!
|
||||
}
|
||||
|
||||
type DashboardConfigType {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ export const LearnpathLearningContentAssignmentAssignmentTypeChoices = "Learnpat
|
|||
export const Mutation = "Mutation";
|
||||
export const PerformanceCriteriaObjectType = "PerformanceCriteriaObjectType";
|
||||
export const PresenceRecord = "PresenceRecord";
|
||||
export const ProgressDashboardAssignmentType = "ProgressDashboardAssignmentType";
|
||||
export const ProgressDashboardCompetenceType = "ProgressDashboardCompetenceType";
|
||||
export const Query = "Query";
|
||||
export const SendFeedbackMutation = "SendFeedbackMutation";
|
||||
export const String = "String";
|
||||
|
|
|
|||
|
|
@ -285,6 +285,18 @@ export const DASHBOARD_COURSE_SESSION_PROGRESS = graphql(`
|
|||
course_progress(course_id: $courseId) {
|
||||
id
|
||||
session_to_continue_id
|
||||
competence {
|
||||
_id
|
||||
total_count
|
||||
success_count
|
||||
fail_count
|
||||
}
|
||||
assignment {
|
||||
_id
|
||||
total_count
|
||||
points_max_count
|
||||
points_achieved_count
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ from typing import Dict, List, Set, Tuple
|
|||
|
||||
import graphene
|
||||
|
||||
from vbv_lernwelt.assignment.models import AssignmentCompletion, AssignmentCompletionStatus
|
||||
from vbv_lernwelt.assignment.models import (
|
||||
AssignmentCompletion,
|
||||
AssignmentCompletionStatus,
|
||||
)
|
||||
from vbv_lernwelt.core.admin import User
|
||||
from vbv_lernwelt.course.models import Course, CourseSession, CourseSessionUser
|
||||
from vbv_lernwelt.course_session_group.models import CourseSessionGroup
|
||||
|
|
@ -11,7 +14,9 @@ from vbv_lernwelt.dashboard.graphql.types.dashboard import (
|
|||
CourseProgressType,
|
||||
CourseStatisticsType,
|
||||
DashboardConfigType,
|
||||
DashboardType, ProgressDashboardCompetenceType, ProgressDashboardAssignmentType,
|
||||
DashboardType,
|
||||
ProgressDashboardAssignmentType,
|
||||
ProgressDashboardCompetenceType,
|
||||
)
|
||||
from vbv_lernwelt.iam.permissions import (
|
||||
can_view_course_session,
|
||||
|
|
@ -110,7 +115,7 @@ class DashboardQuery(graphene.ObjectType):
|
|||
# competence
|
||||
_, success_total, fail_total = competences(
|
||||
course_slug=str(course.slug),
|
||||
course_session_selection_ids=course_session_for_user
|
||||
course_session_selection_ids=course_session_for_user,
|
||||
)
|
||||
|
||||
# assignment
|
||||
|
|
@ -121,21 +126,27 @@ class DashboardQuery(graphene.ObjectType):
|
|||
).values("evaluation_max_points", "evaluation_points")
|
||||
|
||||
evaluation_results = list(evaluation_results)
|
||||
points_max_count = sum([result.get("evaluation_max_points", 0) for result in evaluation_results])
|
||||
points_achieved_count = sum([result.get("evaluation_points", 0) for result in evaluation_results])
|
||||
points_max_count = sum(
|
||||
[result.get("evaluation_max_points", 0) for result in evaluation_results]
|
||||
)
|
||||
points_achieved_count = sum(
|
||||
[result.get("evaluation_points", 0) for result in evaluation_results]
|
||||
)
|
||||
|
||||
return CourseProgressType(
|
||||
id=course_id, # noqa
|
||||
session_to_continue_id=newest.id if newest else None, # noqa
|
||||
competence=ProgressDashboardCompetenceType( # noqa
|
||||
total_count=success_total + fail_total, # noqa
|
||||
success_count=success_total, # noqa
|
||||
fail_count=fail_total, # noqa
|
||||
id=course_id, # noqa
|
||||
session_to_continue_id=newest.id if newest else None, # noqa
|
||||
competence=ProgressDashboardCompetenceType( # noqa
|
||||
_id=course_id, # noqa
|
||||
total_count=success_total + fail_total, # noqa
|
||||
success_count=success_total, # noqa
|
||||
fail_count=fail_total, # noqa
|
||||
),
|
||||
assignment=ProgressDashboardAssignmentType( # noqa
|
||||
total_count=len(evaluation_results), # noqa
|
||||
points_max_count=points_max_count, # noqa
|
||||
points_achieved_count=points_achieved_count, # noqa
|
||||
assignment=ProgressDashboardAssignmentType( # noqa
|
||||
_id=course_id, # noqa
|
||||
total_count=len(evaluation_results), # noqa
|
||||
points_max_count=points_max_count, # noqa
|
||||
points_achieved_count=points_achieved_count, # noqa
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,14 @@ class DashboardConfigType(graphene.ObjectType):
|
|||
|
||||
|
||||
class ProgressDashboardCompetenceType(graphene.ObjectType):
|
||||
_id = graphene.ID(required=True)
|
||||
total_count = graphene.Int(required=True)
|
||||
success_count = graphene.Int(required=True)
|
||||
fail_count = graphene.Int(required=True)
|
||||
|
||||
|
||||
class ProgressDashboardAssignmentType(graphene.ObjectType):
|
||||
_id = graphene.ID(required=True)
|
||||
total_count = graphene.Int(required=True)
|
||||
points_max_count = graphene.Int(required=True)
|
||||
points_achieved_count = graphene.Int(required=True)
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ from vbv_lernwelt.course.models import CourseSessionUser
|
|||
from vbv_lernwelt.dashboard.tests.graphql.utils import (
|
||||
add_course_session_group_supervisor,
|
||||
add_course_session_user,
|
||||
create_assignment,
|
||||
create_assignment_completion,
|
||||
create_course,
|
||||
create_course_session,
|
||||
create_course_session_group,
|
||||
create_user,
|
||||
create_assignment_completion,
|
||||
create_assignment,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue