更新
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:new_learn/core/utils/question/exam_answer_card.dart';
|
||||
import 'package:new_learn/core/utils/question/question_parser.dart';
|
||||
import 'package:new_learn/features/conquerPackage/classExercises/models/question_model.dart';
|
||||
|
||||
void main() {
|
||||
final raw = File(
|
||||
'assets/mock/class_exercises_edit.json',
|
||||
).readAsStringSync();
|
||||
final list = jsonDecode(raw) as List;
|
||||
|
||||
for (final subjectId in [0, 2, 3]) {
|
||||
print('########## subjectId=$subjectId ##########');
|
||||
for (final idx in [11, 12]) {
|
||||
final item = Map<String, dynamic>.from(list[idx] as Map);
|
||||
|
||||
final parsed = parseQuestionData(item, mergeOriginalChilds: true);
|
||||
var sorted = appendQuestionSort([parsed]);
|
||||
sorted = appendExamQuestionChildOptionStatus(sorted, subjectId);
|
||||
|
||||
final q = QuestionModel(sorted.first);
|
||||
print(
|
||||
'Q$idx ${q.questionTypes}: hasOptionChildrenQuestion='
|
||||
'${q.hasOptionChildrenQuestion} subs=${q.subQuestions.length} '
|
||||
'childs=${q.childs.length}',
|
||||
);
|
||||
for (var i = 0; i < q.subQuestions.length; i++) {
|
||||
final s = q.subQuestions[i];
|
||||
final cleaned = cleanRichText(stripOptionTable(s.stem));
|
||||
print(
|
||||
' sub$i options=${s.options.length} '
|
||||
'cleanedStemLen=${cleaned.length} '
|
||||
'cleanedStem=${cleaned.length > 120 ? cleaned.substring(0, 120) : cleaned}',
|
||||
);
|
||||
if (i == 1) break;
|
||||
}
|
||||
if (q.subQuestions.length > 2) print(' ...');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user