move move frontend to progress-test

This commit is contained in:
João Geonizeli
2022-07-21 21:16:59 -03:00
parent f8d5d08447
commit 386050d4ad
129 changed files with 159374 additions and 39 deletions

View File

@@ -0,0 +1,106 @@
import React, {FC} from 'react'
import {gql, useQuery} from '@apollo/client'
import {Query} from '../../../__generated__/graphql-schema'
import {Pie} from '../components/charts'
import {useDashboardContext} from "../DashboardContext";
type ResponsivePieData = {
id: string
label: string
value: number
}[]
type QuestionsByBloomTaxonomyCountQuery = {
remember: Query['questions']
understand: Query['questions']
apply: Query['questions']
analyze: Query['questions']
evaluate: Query['questions']
create: Query['questions']
}
const QuestionsByBloomTaxonomyCount = gql`
query QuestionsByBloomTaxonomyCount (
$rememberWhere: QuestionWhereInput!,
$understandWhere: QuestionWhereInput!,
$applyWhere: QuestionWhereInput!,
$analyzeWhere: QuestionWhereInput!,
$evaluateWhere: QuestionWhereInput!,
$createWhere: QuestionWhereInput!,
) {
remember: questions(where: $rememberWhere) {
totalCount
}
understand: questions(where: $understandWhere) {
totalCount
}
apply: questions(where: $applyWhere) {
totalCount
}
analyze: questions(where: $analyzeWhere) {
totalCount
}
evaluate: questions(where: $evaluateWhere) {
totalCount
}
create: questions(where: $createWhere) {
totalCount
}
}
`
export const QuestionByBloomTaxonomy: FC = () => {
const {where} = useDashboardContext()
const {loading, data} = useQuery<QuestionsByBloomTaxonomyCountQuery>(
QuestionsByBloomTaxonomyCount, {
variables: {
rememberWhere: {bloomTaxonomy: ['remember'], ...where},
understandWhere: {bloomTaxonomy: ['understand'], ...where},
applyWhere: {bloomTaxonomy: ['apply'], ...where},
analyzeWhere: {bloomTaxonomy: ['analyze'], ...where},
evaluateWhere: {bloomTaxonomy: ['evaluate'], ...where},
createWhere: {bloomTaxonomy: ['create'], ...where},
}
})
if (loading || !data) return null
const mappedData: ResponsivePieData = [
{
id: "Recordar",
label: "Recordar",
value: data.remember.totalCount ?? 0
},
{
id: "Compreender",
label: "Compreender",
value: data.understand.totalCount ?? 0
},
{
id: "Aplicar",
label: "Aplicar",
value: data.apply.totalCount ?? 0
},
{
id: "Analisar",
label: "Analisar",
value: data.analyze.totalCount ?? 0
},
{
id: "Avaliar",
label: "Avaliar",
value: data.evaluate.totalCount ?? 0
},
{
id: "Criar",
label: "Criar",
value: data.create.totalCount ?? 0
},
]
const filteredData = mappedData.filter(item => item.value)
return (
<Pie title="Questões por Habilidade Cognitiva" data={filteredData}/>
)
}

View File

@@ -0,0 +1,150 @@
import React, {FC} from 'react'
import {gql, useQuery} from '@apollo/client'
import {Query} from '../../../__generated__/graphql-schema'
import {Pie} from '../components/charts'
import {useDashboardContext} from "../DashboardContext";
type ResponsivePieData = {
id: string
label: string
value: number
}[]
type QuestionsByCheckTypeCountQuery = {
uniqueAnswer: Query['questions']
incompleteAffirmation: Query['questions']
multipleAnswer: Query['questions']
negativeFocus: Query['questions']
assertionAndReason: Query['questions']
gap: Query['questions']
interpretation: Query['questions']
association: Query['questions']
orderingOrRanking: Query['questions']
constantAlternatives: Query['questions']
}
const QuestionsByCheckTypeCount = gql`
query QuestionsByCheckTypeCount(
$uniqueAnswer: QuestionWhereInput!,
$incompleteAffirmation: QuestionWhereInput!,
$multipleAnswer: QuestionWhereInput!,
$negativeFocus: QuestionWhereInput!,
$assertionAndReason: QuestionWhereInput!,
$gap: QuestionWhereInput!,
$interpretation: QuestionWhereInput!,
$association: QuestionWhereInput!,
$orderingOrRanking: QuestionWhereInput!,
$constantAlternatives: QuestionWhereInput!,
) {
uniqueAnswer: questions(where: $uniqueAnswer) {
totalCount
}
incompleteAffirmation: questions(where: $incompleteAffirmation) {
totalCount
}
multipleAnswer: questions(where: $multipleAnswer) {
totalCount
}
negativeFocus: questions(where: $negativeFocus) {
totalCount
}
assertionAndReason: questions(where: $assertionAndReason) {
totalCount
}
gap: questions(where: $gap) {
totalCount
}
interpretation: questions(where: $interpretation) {
totalCount
}
association: questions(where: $association) {
totalCount
}
orderingOrRanking: questions(where: $orderingOrRanking) {
totalCount
}
constantAlternatives: questions(where: $constantAlternatives) {
totalCount
}
}
`
export const QuestionByCheckType: FC = () => {
const {where} = useDashboardContext()
const {loading, data} = useQuery<QuestionsByCheckTypeCountQuery>(
QuestionsByCheckTypeCount, {
variables: {
uniqueAnswer: {checkType: ['unique_answer'], ...where},
incompleteAffirmation: {checkType: ['incomplete_affirmation'], ...where},
multipleAnswer: {checkType: ['multiple_answer'], ...where},
negativeFocus: {checkType: ['negative_focus'], ...where},
assertionAndReason: {checkType: ['assertion_and_reason'], ...where},
gap: {checkType: ['gap'], ...where},
interpretation: {checkType: ['interpretation'], ...where},
association: {checkType: ['association'], ...where},
orderingOrRanking: {checkType: ['ordering_or_ranking'], ...where},
constantAlternatives: {checkType: ['constant_alternatives'], ...where},
}
})
if (loading || !data) return null
const mappedData: ResponsivePieData = [
{
id: "Asserção e Razão",
label: "Asserção e Razão",
value: data.assertionAndReason.totalCount ?? 0
},
{
id: "Associação",
label: "Associação",
value: data.association.totalCount ?? 0
},
{
id: "Alternativas Constantes",
label: "Alternativas Constantes",
value: data.constantAlternatives.totalCount ?? 0
},
{
id: "Lacuna",
label: "Lacuna",
value: data.gap.totalCount ?? 0
},
{
id: "Afirmação Incompleta",
label: "Afirmação Incompleta",
value: data.incompleteAffirmation.totalCount ?? 0
},
{
id: "Interpretação",
label: "Interpretação",
value: data.interpretation.totalCount ?? 0
},
{
id: "Resposta Múltipla",
label: "Resposta Múltipla",
value: data.multipleAnswer.totalCount ?? 0
},
{
id: "Foco Negativo",
label: "Foco Negativo",
value: data.negativeFocus.totalCount ?? 0
},
{
id: "Ordenação ou Seriação",
label: "Ordenação ou Seriação",
value: data.orderingOrRanking.totalCount ?? 0
},
{
id: "Resposta Única",
label: "Resposta Única",
value: data.uniqueAnswer.totalCount ?? 0
},
]
const filteredData = mappedData.filter(item => item.value)
return (
<Pie title="Questões por Tipo" data={filteredData}/>
)
}

View File

@@ -0,0 +1,73 @@
import React, {FC} from 'react'
import {gql, useQuery} from '@apollo/client'
import {Query} from '../../../__generated__/graphql-schema'
import {Pie} from '../components/charts'
import {useDashboardContext} from "../DashboardContext";
type ResponsivePieData = {
id: string
label: string
value: number
}[]
type QuestionsByDifficultyCountQuery = {
easy: Query['questions']
medium: Query['questions']
hard: Query['questions']
}
const QuestionsByDifficultyCount = gql`
query QuestionsByDifficultyCount(
$easyWhere: QuestionWhereInput!,
$mediumWhere: QuestionWhereInput!,
$hardWhere: QuestionWhereInput!,
) {
easy: questions(where: $easyWhere) {
totalCount
}
medium: questions(where: $mediumWhere) {
totalCount
}
hard: questions(where: $hardWhere) {
totalCount
}
}
`
export const QuestionsByDifficulty: FC = () => {
const {where} = useDashboardContext()
const {loading, data} = useQuery<QuestionsByDifficultyCountQuery>(
QuestionsByDifficultyCount, {
variables: {
easyWhere: {difficulty: ['easy'], ...where},
mediumWhere: {difficulty: ['medium'], ...where},
hardWhere: {difficulty: ['hard'], ...where},
},
})
if (loading || !data) return null
const mappedData: ResponsivePieData = [
{
id: "Fácil",
label: "Fácil",
value: data.easy.totalCount ?? 0
},
{
id: "Difícil",
label: "Difícil",
value: data.hard.totalCount ?? 0
},
{
id: "Média",
label: "Média",
value: data.medium.totalCount ?? 0
},
]
const filteredData = mappedData.filter(item => item.value)
return (
<Pie title="Questões por Dificuldade" data={filteredData}/>
)
}

View File

@@ -0,0 +1,50 @@
import React, {FC} from 'react'
import {gql, useQuery} from '@apollo/client'
import {Query} from '../../../__generated__/graphql-schema'
import {Pie} from '../components/charts'
import {useDashboardContext} from "../DashboardContext";
type ResponsivePieData = {
id: string
label: string
value: number
}[]
const QuestionsBySubjectCount = gql`
query QuestionsBySubjectCount($where: QuestionWhereInput!) {
subjects {
nodes {
id
name
questions(where: $where) {
totalCount
}
}
}
}
`
export const QuestionsBySubject: FC = () => {
const {where} = useDashboardContext()
const {loading, data} = useQuery<Query>(QuestionsBySubjectCount, {
variables: {
where,
},
})
if (loading) return null
const subjects = data?.subjects.nodes ?? []
const subjectWithQuestions = subjects.filter(subject => !!subject?.questions.totalCount)
const mappedData: ResponsivePieData = subjectWithQuestions.map(subject => ({
id: subject.name,
label: subject.name,
value: subject.questions.totalCount,
}))
const filteredData = mappedData.filter(item => item.value)
return (
<Pie title="Questões por Assunto" data={filteredData}/>
)
}

View File

@@ -0,0 +1,4 @@
export * from "./QuestionsBySubject";
export * from "./QuestionsByBloomTaxonomy";
export * from "./QuestionsByDifficulty";
export * from "./QuestionsByCheckType";