CleanExamDto
This commit is contained in:
@@ -40,7 +40,7 @@ namespace TechHelper.Client.Exam
|
||||
|
||||
public static class ExamStructExtensions
|
||||
{
|
||||
public static ExamStruct GetStruct(this ExamDto dto)
|
||||
public static ExamStruct GetStruct(this AssignmentDto dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace TechHelper.Client.Exam
|
||||
|
||||
var examStruct = new ExamStruct
|
||||
{
|
||||
Title = dto.AssignmentTitle
|
||||
Title = dto.Title
|
||||
};
|
||||
|
||||
GetSeqRecursive(dto.ExamStruct, null, examStruct.Questions);
|
||||
@@ -64,7 +64,7 @@ namespace TechHelper.Client.Exam
|
||||
/// <param name="parentSequence">当前题目组的父级序号(例如:"1", "2.1")。如果为空,则表示顶级题目组。</param>
|
||||
/// <param name="allQuestions">用于收集所有生成题目项的列表。</param>
|
||||
private static void GetSeqRecursive(
|
||||
QuestionGroupDto currentGroup,
|
||||
AssignmentQuestionDto currentGroup,
|
||||
string? parentSequence,
|
||||
List<ExamStruct.QuestionItem> allQuestions)
|
||||
{
|
||||
@@ -72,18 +72,7 @@ namespace TechHelper.Client.Exam
|
||||
? $"{parentSequence}.{currentGroup.Index}"
|
||||
: currentGroup.Index.ToString();
|
||||
|
||||
foreach (var subQuestion in currentGroup.SubQuestions)
|
||||
{
|
||||
string fullSequence = $"{currentGroupSequence}.{subQuestion.Index}";
|
||||
allQuestions.Add(new ExamStruct.QuestionItem
|
||||
{
|
||||
Sequence = fullSequence,
|
||||
QuestionText = subQuestion.Stem ?? string.Empty,
|
||||
Score = subQuestion.Score
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var subGroup in currentGroup.SubQuestionGroups)
|
||||
foreach (var subGroup in currentGroup.ChildrenAssignmentQuestion)
|
||||
{
|
||||
GetSeqRecursive(subGroup, currentGroupSequence, allQuestions);
|
||||
}
|
||||
|
Reference in New Issue
Block a user