Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate numerical question evaluation on asynchronous activities to new histogram #4340

Merged
merged 6 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/frontend-manage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@klicker-uzh/prisma": "workspace:*",
"@klicker-uzh/shared-components": "workspace:*",
"@socialgouv/matomo-next": "1.9.1",
"@tanstack/react-table": "8.20.5",
"@uzh-bf/design-system": "3.0.0-alpha.32",
"d3": "7.9.0",
"dayjs": "1.11.13",
Expand All @@ -39,7 +38,6 @@
"next-intl": "3.21.1",
"nookies": "2.5.2",
"react": "18.3.1",
"react-csv-downloader": "3.1.1",
"react-d3-speedometer": "2.2.1",
"react-dnd": "16.0.1",
"react-dnd-html5-backend": "16.0.1",
Expand All @@ -49,7 +47,6 @@
"react-resizable-panels": "2.1.4",
"react-select": "5.8.1",
"react-sizeme": "3.0.2",
"react-tagcloud": "2.3.3",
"recharts": "2.13.0",
"remark-slate": "1.8.6",
"remeda": "2.15.0",
Expand Down Expand Up @@ -81,6 +78,7 @@
"eslint-config-next": "~15.0.0",
"postcss": "~8.4.47",
"postcss-import": "~16.1.0",
"react-tagcloud": "~2.3.3",
"swc-loader": "~0.2.6",
"tailwindcss": "~3.4.14",
"tailwindcss-radix": "~3.0.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DataTable from '@components/common/DataTable'
import { LeaderboardEntry } from '@klicker-uzh/graphql/dist/ops'
import DataTable from '@klicker-uzh/shared-components/src/DataTable'
import { Tabs } from '@uzh-bf/design-system'
import { TableCell } from '@uzh-bf/design-system/dist/future'
import { useTranslations } from 'next-intl'
Expand Down
21 changes: 16 additions & 5 deletions apps/frontend-manage/src/components/evaluation/ElementChart.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ElementInstanceEvaluation } from '@klicker-uzh/graphql/dist/ops'
import ElementBarChart from '@klicker-uzh/shared-components/src/charts/ElementBarChart'
import ElementHistogram from '@klicker-uzh/shared-components/src/charts/ElementHistogram'
import ElementTableChart from '@klicker-uzh/shared-components/src/charts/ElementTableChart'
import ElementWordcloud from '@klicker-uzh/shared-components/src/charts/ElementWordcloud'
import { ChartType } from '@klicker-uzh/shared-components/src/constants'
import { useTranslations } from 'next-intl'
import React from 'react'
import { TextSizeType } from '../sessions/evaluation/constants'
import ElementBarChart from './charts/ElementBarChart'
import ElementHistogram from './charts/ElementHistogram'
import ElementTableChart from './charts/ElementTableChart'
import ElementWordcloud from './charts/ElementWordcloud'

interface ElementChartProps {
chartType: string
Expand Down Expand Up @@ -35,9 +35,20 @@ function ElementChart({
chartType === ChartType.HISTOGRAM &&
instanceEvaluation.__typename === 'NumericalElementInstanceEvaluation'
) {
const responses = instanceEvaluation.results.responseValues.map(
(response) => ({
value: response.value,
count: response.count,
})
)

return (
<ElementHistogram
instance={instanceEvaluation}
type={instanceEvaluation.type}
responses={responses}
solutionRanges={instanceEvaluation.results.solutionRanges}
minValue={instanceEvaluation.results.minValue}
maxValue={instanceEvaluation.results.maxValue}
showSolution={{ general: showSolution }}
textSize={textSize.text}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function StudentElementPreview({
: undefined,
accuracy:
'accuracy' in values.options &&
values.options.accuracy
typeof values.options.accuracy !== 'undefined' &&
values.options.accuracy !== null
? parseInt(String(values.options.accuracy))
: undefined,
unit:
Expand All @@ -72,7 +73,9 @@ function StudentElementPreview({
'restrictions' in values.options &&
values.options.restrictions &&
'min' in values.options.restrictions &&
values.options.restrictions.min
typeof values.options.restrictions.min !==
'undefined' &&
values.options.restrictions.min !== null
? parseFloat(
String(values.options.restrictions.min)
)
Expand All @@ -81,7 +84,9 @@ function StudentElementPreview({
'restrictions' in values.options &&
values.options.restrictions &&
'max' in values.options.restrictions &&
values.options.restrictions.max
typeof values.options.restrictions.max !==
'undefined' &&
values.options.restrictions.max !== null
? parseFloat(
String(values.options.restrictions.max)
)
Expand All @@ -90,7 +95,9 @@ function StudentElementPreview({
'restrictions' in values.options &&
values.options.restrictions &&
'maxLength' in values.options.restrictions &&
values.options.restrictions.maxLength
typeof values.options.restrictions.maxLength !==
'undefined' &&
values.options.restrictions.maxLength !== null
? parseFloat(
String(values.options.restrictions.maxLength)
)
Expand Down
11 changes: 10 additions & 1 deletion apps/frontend-manage/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
"@type/*": ["src/types/*"]
}
},
"include": ["next-env.d.ts", "src/types/app.d.ts", "**/*.ts", "**/*.tsx"],
"include": [
"next-env.d.ts",
"src/types/app.d.ts",
"**/*.ts",
"**/*.tsx",
"../../packages/shared-components/src/hooks/useEvaluationBarChartData.tsx",
"../../packages/shared-components/src/hooks/useEvaluationHistogramData.tsx",
"../../packages/shared-components/src/hooks/useEvaluationTableColumns.tsx",
"../../packages/shared-components/src/hooks/useEvaluationTableData.tsx"
],
"exclude": ["node_modules"]
}
Loading
Loading