diff --git a/client/src/gql/graphql.ts b/client/src/gql/graphql.ts index 6899be04..d98966b7 100644 --- a/client/src/gql/graphql.ts +++ b/client/src/gql/graphql.ts @@ -1042,7 +1042,7 @@ export type TopicObjectType = CoursePageInterface & { export type UserObjectType = { __typename?: 'UserObjectType'; - avatar_url: Scalars['String']['output']; + avatar_url?: Maybe; email: Scalars['String']['output']; first_name: Scalars['String']['output']; id: Scalars['UUID']['output']; @@ -1139,7 +1139,7 @@ export type AssignmentCompletionQueryQueryVariables = Exact<{ export type AssignmentCompletionQueryQuery = { __typename?: 'Query', assignment?: { __typename?: 'AssignmentObjectType', assignment_type: AssignmentAssignmentAssignmentTypeChoices, needs_expert_evaluation: boolean, max_points?: number | null, content_type: string, effort_required: string, evaluation_description: string, evaluation_document_url: string, evaluation_tasks?: any | null, id: string, intro_text: string, performance_objectives?: any | null, slug: string, tasks?: any | null, title: string, translation_key: string, solution_sample?: { __typename?: 'ContentDocumentObjectType', id: string, url?: string | null } | null, competence_certificate?: ( { __typename?: 'CompetenceCertificateObjectType' } & { ' $fragmentRefs'?: { 'CoursePageFieldsCompetenceCertificateObjectTypeFragment': CoursePageFieldsCompetenceCertificateObjectTypeFragment } } - ) | null } | null, assignment_completion?: { __typename?: 'AssignmentCompletionObjectType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: string | null, evaluation_submitted_at?: string | null, evaluation_points?: number | null, evaluation_max_points?: number | null, evaluation_passed?: boolean | null, edoniq_extended_time_flag: boolean, completion_data?: any | null, task_completion_data?: any | null, evaluation_user?: { __typename?: 'UserObjectType', id: string, first_name: string, last_name: string } | null, assignment_user: { __typename?: 'UserObjectType', avatar_url: string, first_name: string, last_name: string, id: string } } | null }; + ) | null } | null, assignment_completion?: { __typename?: 'AssignmentCompletionObjectType', id: string, completion_status: AssignmentAssignmentCompletionCompletionStatusChoices, submitted_at?: string | null, evaluation_submitted_at?: string | null, evaluation_points?: number | null, evaluation_max_points?: number | null, evaluation_passed?: boolean | null, edoniq_extended_time_flag: boolean, completion_data?: any | null, task_completion_data?: any | null, evaluation_user?: { __typename?: 'UserObjectType', id: string, first_name: string, last_name: string } | null, assignment_user: { __typename?: 'UserObjectType', avatar_url?: string | null, first_name: string, last_name: string, id: string } } | null }; export type CompetenceCertificateQueryQueryVariables = Exact<{ courseSlug: Scalars['String']['input']; diff --git a/client/src/gql/schema.graphql b/client/src/gql/schema.graphql index 989ed785..418e18ba 100644 --- a/client/src/gql/schema.graphql +++ b/client/src/gql/schema.graphql @@ -552,8 +552,6 @@ type AssignmentCompletionObjectType { submitted_at: DateTime evaluation_submitted_at: DateTime evaluation_user: UserObjectType - evaluation_points: Float - evaluation_max_points: Float evaluation_passed: Boolean edoniq_extended_time_flag: Boolean! assignment_user: UserObjectType! @@ -564,6 +562,8 @@ type AssignmentCompletionObjectType { additional_json_data: JSONString! task_completion_data: GenericScalar learning_content_page_id: ID + evaluation_points: Float + evaluation_max_points: Float } """ @@ -580,9 +580,9 @@ type UserObjectType { first_name: String! last_name: String! id: UUID! - avatar_url: String! email: String! language: CoreUserLanguageChoices! + avatar_url: String } """An enumeration.""" diff --git a/server/vbv_lernwelt/assignment/graphql/types.py b/server/vbv_lernwelt/assignment/graphql/types.py index cf0267ca..b8a23d3d 100644 --- a/server/vbv_lernwelt/assignment/graphql/types.py +++ b/server/vbv_lernwelt/assignment/graphql/types.py @@ -17,6 +17,10 @@ class AssignmentCompletionObjectType(DjangoObjectType): task_completion_data = GenericScalar() learning_content_page_id = graphene.ID(source="learning_content_page_id") + # rounded to sensible representation + evaluation_points = graphene.Float() + evaluation_max_points = graphene.Float() + class Meta: model = AssignmentCompletion fields = ( @@ -34,12 +38,20 @@ class AssignmentCompletionObjectType(DjangoObjectType): "evaluation_user", "additional_json_data", "edoniq_extended_time_flag", - "evaluation_points", "evaluation_passed", - "evaluation_max_points", "task_completion_data", ) + def resolve_evaluation_points(self, info): + if self.evaluation_points: + return round(self.evaluation_points, 1) # noqa + return None + + def resolve_evaluation_max_points(self, info): + if self.evaluation_max_points: + return round(self.evaluation_max_points, 1) # noqa + return None + class AssignmentObjectType(DjangoObjectType): tasks = JSONStreamField()