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