Question düzenlemeleri
This commit is contained in:
parent
bf31e0e1a8
commit
f796daaafb
10 changed files with 41 additions and 29 deletions
|
|
@ -7633,6 +7633,12 @@
|
||||||
"tr": "Tanımlamalar",
|
"tr": "Tanımlamalar",
|
||||||
"en": "Definitions"
|
"en": "Definitions"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "App.Coordinator.Questions",
|
||||||
|
"tr": "Sorular",
|
||||||
|
"en": "Questions"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "App.Routes",
|
"key": "App.Routes",
|
||||||
|
|
@ -14611,20 +14617,30 @@
|
||||||
"IsDisabled": false
|
"IsDisabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ParentCode": "App.Coordinator.Definitions",
|
"ParentCode": "App.Coordinator",
|
||||||
|
"Code": "App.Coordinator.Questions",
|
||||||
|
"DisplayName": "App.Coordinator.Questions",
|
||||||
|
"Order": 2,
|
||||||
|
"Url": null,
|
||||||
|
"Icon": "FcIdea",
|
||||||
|
"RequiredPermissionName": null,
|
||||||
|
"IsDisabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ParentCode": "App.Coordinator.Questions",
|
||||||
"Code": "App.Definitions.QuestionTag",
|
"Code": "App.Definitions.QuestionTag",
|
||||||
"DisplayName": "App.Definitions.QuestionTag",
|
"DisplayName": "App.Definitions.QuestionTag",
|
||||||
"Order": 10,
|
"Order": 1,
|
||||||
"Url": "/admin/list/list-questiontag",
|
"Url": "/admin/list/list-questiontag",
|
||||||
"Icon": "FcTags",
|
"Icon": "FcTags",
|
||||||
"RequiredPermissionName": "App.Definitions.QuestionTag",
|
"RequiredPermissionName": "App.Definitions.QuestionTag",
|
||||||
"IsDisabled": false
|
"IsDisabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ParentCode": "App.Coordinator.Definitions",
|
"ParentCode": "App.Coordinator.Questions",
|
||||||
"Code": "App.Definitions.QuestionPool",
|
"Code": "App.Definitions.QuestionPool",
|
||||||
"DisplayName": "App.Definitions.QuestionPool",
|
"DisplayName": "App.Definitions.QuestionPool",
|
||||||
"Order": 11,
|
"Order": 2,
|
||||||
"Url": "/admin/list/list-questionpool",
|
"Url": "/admin/list/list-questionpool",
|
||||||
"Icon": "FcQuestions",
|
"Icon": "FcQuestions",
|
||||||
"RequiredPermissionName": "App.Definitions.QuestionPool",
|
"RequiredPermissionName": "App.Definitions.QuestionPool",
|
||||||
|
|
|
||||||
|
|
@ -52,3 +52,5 @@ export const postSeedTenantData = (data: SeedTenantDataInput) =>
|
||||||
url: `/api/app/platform-tenant/seed-tenant-data`,
|
url: `/api/app/platform-tenant/seed-tenant-data`,
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { Button } from '@/components/ui'
|
||||||
import { Container } from '@/components/shared'
|
import { Container } from '@/components/shared'
|
||||||
import { Dialog, Notification, toast } from '@/components/ui'
|
import { Dialog, Notification, toast } from '@/components/ui'
|
||||||
import type { BranchSeedResultDto } from '@/proxy/branch/seed'
|
import type { BranchSeedResultDto } from '@/proxy/branch/seed'
|
||||||
import { runBranchSeed } from '@/services/branch'
|
import { runBranchSeed } from '@/services/branch.service'
|
||||||
|
|
||||||
function BranchSeed({
|
function BranchSeed({
|
||||||
open,
|
open,
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,8 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
|
|
||||||
const [selectedPool, setSelectedPool] = useState<string>("");
|
const [selectedPool, setSelectedPool] = useState<string>("");
|
||||||
const [questionFilters, setQuestionFilters] = useState({
|
const [questionFilters, setQuestionFilters] = useState({
|
||||||
type: "",
|
questionType: "",
|
||||||
difficulty: "",
|
difficulty: "",
|
||||||
tag: "",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleInputChange = (field: string, value: any) => {
|
const handleInputChange = (field: string, value: any) => {
|
||||||
|
|
@ -52,9 +51,9 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
let questionsToAdd = pool.questions;
|
let questionsToAdd = pool.questions;
|
||||||
|
|
||||||
// Apply filters
|
// Apply filters
|
||||||
if (questionFilters.type) {
|
if (questionFilters.questionType) {
|
||||||
questionsToAdd = questionsToAdd.filter(
|
questionsToAdd = questionsToAdd.filter(
|
||||||
(q) => q.type === questionFilters.type
|
(q) => q.questionType === questionFilters.questionType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (questionFilters.difficulty) {
|
if (questionFilters.difficulty) {
|
||||||
|
|
@ -62,11 +61,6 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
(q) => q.difficulty === questionFilters.difficulty
|
(q) => q.difficulty === questionFilters.difficulty
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (questionFilters.tag) {
|
|
||||||
questionsToAdd = questionsToAdd.filter((q) =>
|
|
||||||
q.tags.includes(questionFilters.tag)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add questions that aren't already selected
|
// Add questions that aren't already selected
|
||||||
const newQuestions = questionsToAdd.filter(
|
const newQuestions = questionsToAdd.filter(
|
||||||
|
|
@ -371,11 +365,11 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
Question Type
|
Question Type
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={questionFilters.type}
|
value={questionFilters.questionType}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setQuestionFilters((prev) => ({
|
setQuestionFilters((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
type: e.target.value,
|
questionType: e.target.value,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
className="w-full text-sm border border-gray-300 rounded-lg px-2 py-1 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full text-sm border border-gray-300 rounded-lg px-2 py-1 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
|
@ -450,7 +444,7 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="flex items-center space-x-2 mb-1">
|
<div className="flex items-center space-x-2 mb-1">
|
||||||
<span className="bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded">
|
<span className="bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded">
|
||||||
{question.type}
|
{question.questionType}
|
||||||
</span>
|
</span>
|
||||||
<span className="bg-green-100 text-green-800 text-xs font-medium px-2 py-1 rounded">
|
<span className="bg-green-100 text-green-800 text-xs font-medium px-2 py-1 rounded">
|
||||||
{question.points} pts
|
{question.points} pts
|
||||||
|
|
@ -480,7 +474,7 @@ export const ExamCreator: React.FC<ExamCreatorProps> = ({
|
||||||
↓
|
↓
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => removeQuestion(question.id)}
|
onClick={() => removeQuestion(question.id!)}
|
||||||
className="p-1 text-red-400 hover:text-red-600 rounded ml-2"
|
className="p-1 text-red-400 hover:text-red-600 rounded ml-2"
|
||||||
>
|
>
|
||||||
✕
|
✕
|
||||||
|
|
@ -33,7 +33,7 @@ export const QuestionRenderer: React.FC<QuestionRendererProps> = ({
|
||||||
showCorrectAnswer
|
showCorrectAnswer
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (question.type) {
|
switch (question.questionType) {
|
||||||
case 'multiple-choice':
|
case 'multiple-choice':
|
||||||
return <MultipleChoiceQuestion {...commonProps} />;
|
return <MultipleChoiceQuestion {...commonProps} />;
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ export const QuestionRenderer: React.FC<QuestionRendererProps> = ({
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<div className="p-4 border border-gray-200 rounded-lg bg-gray-50">
|
<div className="p-4 border border-gray-200 rounded-lg bg-gray-50">
|
||||||
<p className="text-gray-500">Desteklenmeyen soru tipi: {question.type}</p>
|
<p className="text-gray-500">Desteklenmeyen soru tipi: {question.questionType}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ export const QuestionRenderer: React.FC<QuestionRendererProps> = ({
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||||
{getQuestionTypeLabel(question.type)}
|
{getQuestionTypeLabel(question.questionType)}
|
||||||
</span>
|
</span>
|
||||||
{question.points && (
|
{question.points && (
|
||||||
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { ExamCreator } from './AdminPanel/ExamCreator'
|
|
||||||
import {
|
import {
|
||||||
FaPlus,
|
FaPlus,
|
||||||
FaSearch,
|
FaSearch,
|
||||||
|
|
@ -15,6 +14,7 @@ import { useNavigate } from 'react-router-dom'
|
||||||
import { generateMockExam } from '@/mocks/mockExams'
|
import { generateMockExam } from '@/mocks/mockExams'
|
||||||
import { generateMockPools } from '@/mocks/mockPools'
|
import { generateMockPools } from '@/mocks/mockPools'
|
||||||
import { Exam, QuestionPoolDto } from '@/types/coordinator'
|
import { Exam, QuestionPoolDto } from '@/types/coordinator'
|
||||||
|
import { ExamCreator } from './ExamInterface/ExamCreator'
|
||||||
|
|
||||||
const Exams: React.FC = () => {
|
const Exams: React.FC = () => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ function QuestionDialog({
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔹 Option işlemleri
|
// 🔹 Option işlemleri
|
||||||
const addOption = () => {
|
const addOption = (isCorrect: boolean = false) => {
|
||||||
const newOption: QuestionOptionDto = {
|
const newOption: QuestionOptionDto = {
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID(),
|
||||||
text: '',
|
text: '',
|
||||||
isCorrect: false,
|
isCorrect,
|
||||||
}
|
}
|
||||||
setQuestion((prev) =>
|
setQuestion((prev) =>
|
||||||
prev ? { ...prev, options: [...(prev.options || []), newOption] } : prev,
|
prev ? { ...prev, options: [...(prev.options || []), newOption] } : prev,
|
||||||
|
|
@ -146,7 +146,7 @@ function QuestionDialog({
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={addOption}
|
onClick={() => addOption()}
|
||||||
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
||||||
>
|
>
|
||||||
<FaPlus className="w-3.5 h-3.5" />
|
<FaPlus className="w-3.5 h-3.5" />
|
||||||
|
|
@ -203,7 +203,7 @@ function QuestionDialog({
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={addOption}
|
onClick={() => addOption()}
|
||||||
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
||||||
>
|
>
|
||||||
<FaPlus className="w-3.5 h-3.5" />
|
<FaPlus className="w-3.5 h-3.5" />
|
||||||
|
|
@ -270,7 +270,7 @@ function QuestionDialog({
|
||||||
{question?.options?.length! === 0 && (
|
{question?.options?.length! === 0 && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={addOption}
|
onClick={() => addOption(true)}
|
||||||
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
className="flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700"
|
||||||
>
|
>
|
||||||
<FaPlus className="w-3.5 h-3.5" />
|
<FaPlus className="w-3.5 h-3.5" />
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { TestCreator } from './AdminPanel/TestCreator'
|
|
||||||
import {
|
import {
|
||||||
FaPlus,
|
FaPlus,
|
||||||
FaSearch,
|
FaSearch,
|
||||||
|
|
@ -15,6 +14,7 @@ import {
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Exam } from '@/types/coordinator'
|
import { Exam } from '@/types/coordinator'
|
||||||
import { generateMockPDFTest } from '@/mocks/mockTests'
|
import { generateMockPDFTest } from '@/mocks/mockTests'
|
||||||
|
import { TestCreator } from './ExamInterface/TestCreator'
|
||||||
|
|
||||||
const Tests: React.FC = () => {
|
const Tests: React.FC = () => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue