fix: passingScore scaling and dimensions propagation
- Frontend: divide by 10 on load, multiply by 10 on send (UI:0-10, DB:0-100) - Backend: include template dimensions in session templateData snapshot
This commit is contained in:
@@ -76,7 +76,7 @@ export const AssessmentTemplateManager: React.FC = () => {
|
||||
: (template.difficultyDistribution || ''),
|
||||
style: template.style || 'Professional',
|
||||
knowledgeGroupId: template.knowledgeGroupId || '',
|
||||
passingScore: template.passingScore ?? 6,
|
||||
passingScore: template.passingScore ? template.passingScore / 10 : 6,
|
||||
totalTimeLimit: template.totalTimeLimit ?? 1800,
|
||||
perQuestionTimeLimit: template.perQuestionTimeLimit ?? 300,
|
||||
});
|
||||
@@ -107,13 +107,10 @@ export const AssessmentTemplateManager: React.FC = () => {
|
||||
// Convert UI strings back to required types
|
||||
const keywordsArray = formData.keywords.split(',').map(k => k.trim()).filter(k => k !== '');
|
||||
let diffDist: any = formData.difficultyDistribution;
|
||||
try {
|
||||
if (formData.difficultyDistribution.startsWith('{')) {
|
||||
diffDist = JSON.parse(formData.difficultyDistribution);
|
||||
}
|
||||
} catch (e) {
|
||||
// Keep as string if parsing fails
|
||||
if (typeof diffDist === 'string' && diffDist.trim().startsWith('{')) {
|
||||
try { diffDist = JSON.parse(diffDist); } catch (e) { diffDist = undefined; }
|
||||
}
|
||||
if (typeof diffDist !== 'object' || diffDist === null) diffDist = undefined;
|
||||
|
||||
const payload: CreateTemplateData = {
|
||||
name: formData.name,
|
||||
@@ -124,7 +121,7 @@ export const AssessmentTemplateManager: React.FC = () => {
|
||||
style: formData.style,
|
||||
knowledgeGroupId: formData.knowledgeGroupId || undefined,
|
||||
dimensions: dimensions.length > 0 ? dimensions : undefined,
|
||||
passingScore: formData.passingScore,
|
||||
passingScore: formData.passingScore * 10,
|
||||
totalTimeLimit: formData.totalTimeLimit,
|
||||
perQuestionTimeLimit: formData.perQuestionTimeLimit,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user