This commit is contained in:
sjk
2025-11-17 13:39:05 +08:00
commit d4cfe2b9de
479 changed files with 109324 additions and 0 deletions

View File

@@ -0,0 +1,969 @@
import '../models/test_models.dart';
/// 综合测试静态数据类
class TestStaticData {
// 私有构造函数
TestStaticData._();
/// 测试题目静态数据
static final List<TestQuestion> _questions = [
// 词汇题目
TestQuestion(
id: 'vocab_001',
type: QuestionType.multipleChoice,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.beginner,
content: 'What does "apple" mean?',
options: ['苹果', '香蕉', '橙子', '葡萄'],
correctAnswers: ['苹果'],
explanation: 'Apple means 苹果 in Chinese.',
points: 1,
timeLimit: 30,
),
TestQuestion(
id: 'vocab_002',
type: QuestionType.multipleChoice,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.elementary,
content: 'Choose the correct synonym for "happy":',
options: ['sad', 'joyful', 'angry', 'tired'],
correctAnswers: ['joyful'],
explanation: 'Joyful is a synonym for happy.',
points: 1,
timeLimit: 30,
),
TestQuestion(
id: 'vocab_003',
type: QuestionType.multipleSelect,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.intermediate,
content: 'Which of the following are adjectives?',
options: ['beautiful', 'quickly', 'run', 'intelligent', 'book'],
correctAnswers: ['beautiful', 'intelligent'],
explanation: 'Beautiful and intelligent are adjectives that describe nouns.',
points: 2,
timeLimit: 45,
),
// 语法题目
TestQuestion(
id: 'grammar_001',
type: QuestionType.multipleChoice,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.beginner,
content: 'Choose the correct form: "She ___ to school every day."',
options: ['go', 'goes', 'going', 'gone'],
correctAnswers: ['goes'],
explanation: 'Use "goes" for third person singular in present tense.',
points: 1,
timeLimit: 30,
),
TestQuestion(
id: 'grammar_002',
type: QuestionType.fillInBlank,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.elementary,
content: 'Fill in the blank: "I have ___ this book before."',
options: ['read', 'reading', 'reads', 'to read'],
correctAnswers: ['read'],
explanation: 'Use past participle "read" with present perfect tense.',
points: 1,
timeLimit: 45,
),
TestQuestion(
id: 'grammar_003',
type: QuestionType.multipleChoice,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.intermediate,
content: 'Which sentence is grammatically correct?',
options: [
'If I was you, I would study harder.',
'If I were you, I would study harder.',
'If I am you, I would study harder.',
'If I will be you, I would study harder.'
],
correctAnswers: ['If I were you, I would study harder.'],
explanation: 'Use subjunctive mood "were" in hypothetical conditions.',
points: 2,
timeLimit: 60,
),
// 阅读理解题目
TestQuestion(
id: 'reading_001',
type: QuestionType.reading,
skillType: SkillType.reading,
difficulty: DifficultyLevel.elementary,
content: '''
Read the passage and answer the question:
"Tom is a student. He goes to school by bus every morning. His favorite subject is English. After school, he likes to play football with his friends."
What is Tom's favorite subject?
''',
options: ['Math', 'English', 'Science', 'History'],
correctAnswers: ['English'],
explanation: 'The passage clearly states that his favorite subject is English.',
points: 1,
timeLimit: 90,
),
TestQuestion(
id: 'reading_002',
type: QuestionType.reading,
skillType: SkillType.reading,
difficulty: DifficultyLevel.intermediate,
content: '''
Read the passage and answer the question:
"Climate change is one of the most pressing issues of our time. Rising global temperatures are causing ice caps to melt, sea levels to rise, and weather patterns to become increasingly unpredictable. Scientists agree that immediate action is necessary to mitigate these effects."
What is the main concern discussed in the passage?
''',
options: [
'Economic development',
'Climate change and its effects',
'Scientific research methods',
'Weather forecasting'
],
correctAnswers: ['Climate change and its effects'],
explanation: 'The passage focuses on climate change as a pressing issue and its various effects.',
points: 2,
timeLimit: 120,
),
// 听力题目
TestQuestion(
id: 'listening_001',
type: QuestionType.listening,
skillType: SkillType.listening,
difficulty: DifficultyLevel.beginner,
content: 'Listen to the audio and choose what you hear:',
options: ['Hello', 'Help', 'Hill', 'Hall'],
correctAnswers: ['Hello'],
audioUrl: 'assets/audio/hello.mp3',
explanation: 'The audio says "Hello".',
points: 1,
timeLimit: 30,
),
TestQuestion(
id: 'listening_002',
type: QuestionType.listening,
skillType: SkillType.listening,
difficulty: DifficultyLevel.intermediate,
content: 'Listen to the conversation and answer: What time does the meeting start?',
options: ['9:00 AM', '10:00 AM', '11:00 AM', '2:00 PM'],
correctAnswers: ['10:00 AM'],
audioUrl: 'assets/audio/meeting_time.mp3',
explanation: 'The speaker mentions the meeting starts at 10:00 AM.',
points: 2,
timeLimit: 60,
),
// 口语题目
TestQuestion(
id: 'speaking_001',
type: QuestionType.speaking,
skillType: SkillType.speaking,
difficulty: DifficultyLevel.beginner,
content: 'Introduce yourself in English. Include your name, age, and hobby.',
options: [],
correctAnswers: [],
explanation: 'A good introduction should include personal information clearly.',
points: 3,
timeLimit: 120,
),
TestQuestion(
id: 'speaking_002',
type: QuestionType.speaking,
skillType: SkillType.speaking,
difficulty: DifficultyLevel.intermediate,
content: 'Describe your favorite place and explain why you like it.',
options: [],
correctAnswers: [],
explanation: 'Focus on descriptive language and clear reasoning.',
points: 4,
timeLimit: 180,
),
// 写作题目
TestQuestion(
id: 'writing_001',
type: QuestionType.writing,
skillType: SkillType.writing,
difficulty: DifficultyLevel.elementary,
content: 'Write a short paragraph (50-80 words) about your daily routine.',
options: [],
correctAnswers: [],
explanation: 'Include time expressions and daily activities.',
points: 5,
timeLimit: 300,
),
// 更多词汇题目
TestQuestion(
id: 'vocab_004',
type: QuestionType.multipleChoice,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.intermediate,
content: 'What is the meaning of "procrastinate"?',
options: ['to delay or postpone', 'to work quickly', 'to organize', 'to celebrate'],
correctAnswers: ['to delay or postpone'],
explanation: 'Procrastinate means to delay or postpone action.',
points: 2,
timeLimit: 45,
),
TestQuestion(
id: 'vocab_005',
type: QuestionType.fillInBlank,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.upperIntermediate,
content: 'The company\'s success was _____ to their innovative approach.',
options: ['attributed', 'contributed', 'distributed', 'substituted'],
correctAnswers: ['attributed'],
explanation: 'Attributed means credited or ascribed to a particular cause.',
points: 3,
timeLimit: 60,
),
TestQuestion(
id: 'vocab_006',
type: QuestionType.multipleSelect,
skillType: SkillType.vocabulary,
difficulty: DifficultyLevel.advanced,
content: 'Which words are synonyms for "meticulous"?',
options: ['careful', 'careless', 'thorough', 'precise', 'sloppy'],
correctAnswers: ['careful', 'thorough', 'precise'],
explanation: 'Meticulous means showing great attention to detail; very careful and precise.',
points: 4,
timeLimit: 90,
),
// 更多语法题目
TestQuestion(
id: 'grammar_004',
type: QuestionType.multipleChoice,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.intermediate,
content: 'Choose the correct passive voice: "The teacher explains the lesson."',
options: [
'The lesson is explained by the teacher.',
'The lesson was explained by the teacher.',
'The lesson will be explained by the teacher.',
'The lesson has been explained by the teacher.'
],
correctAnswers: ['The lesson is explained by the teacher.'],
explanation: 'Present simple active becomes present simple passive.',
points: 2,
timeLimit: 60,
),
TestQuestion(
id: 'grammar_005',
type: QuestionType.fillInBlank,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.upperIntermediate,
content: 'By the time you arrive, I _____ the report.',
options: ['will finish', 'will have finished', 'finish', 'finished'],
correctAnswers: ['will have finished'],
explanation: 'Use future perfect for actions completed before a future time.',
points: 3,
timeLimit: 75,
),
TestQuestion(
id: 'grammar_006',
type: QuestionType.multipleChoice,
skillType: SkillType.grammar,
difficulty: DifficultyLevel.advanced,
content: 'Which sentence uses the subjunctive mood correctly?',
options: [
'I wish I was taller.',
'I wish I were taller.',
'I wish I am taller.',
'I wish I will be taller.'
],
correctAnswers: ['I wish I were taller.'],
explanation: 'Use "were" in subjunctive mood for hypothetical situations.',
points: 4,
timeLimit: 90,
),
// 更多阅读理解题目
TestQuestion(
id: 'reading_003',
type: QuestionType.reading,
skillType: SkillType.reading,
difficulty: DifficultyLevel.upperIntermediate,
content: '''
Read the passage and answer the question:
"Artificial Intelligence has revolutionized numerous industries, from healthcare to finance. Machine learning algorithms can now diagnose diseases with remarkable accuracy, while automated trading systems execute millions of transactions per second. However, this technological advancement raises important ethical questions about job displacement and privacy concerns."
What is the author's main point about AI?
''',
options: [
'AI is only useful in healthcare',
'AI has transformed industries but raises ethical concerns',
'AI should be banned from trading',
'AI is not accurate enough for medical use'
],
correctAnswers: ['AI has transformed industries but raises ethical concerns'],
explanation: 'The passage discusses both AI\'s benefits and the ethical concerns it raises.',
points: 3,
timeLimit: 150,
),
TestQuestion(
id: 'reading_004',
type: QuestionType.reading,
skillType: SkillType.reading,
difficulty: DifficultyLevel.advanced,
content: '''
Read the passage and answer the question:
"The concept of sustainable development emerged in the 1980s as a response to growing environmental concerns. It encompasses three pillars: economic growth, social equity, and environmental protection. Critics argue that these goals are inherently contradictory, as unlimited economic growth is incompatible with finite planetary resources."
What criticism is mentioned regarding sustainable development?
''',
options: [
'It focuses too much on the environment',
'It ignores social equity',
'Its three pillars are contradictory',
'It was developed too recently'
],
correctAnswers: ['Its three pillars are contradictory'],
explanation: 'Critics argue that unlimited economic growth contradicts environmental protection.',
points: 4,
timeLimit: 180,
),
// 更多听力题目
TestQuestion(
id: 'listening_003',
type: QuestionType.listening,
skillType: SkillType.listening,
difficulty: DifficultyLevel.elementary,
content: 'Listen to the weather forecast and choose the correct information:',
options: ['Sunny, 25°C', 'Rainy, 18°C', 'Cloudy, 22°C', 'Snowy, 5°C'],
correctAnswers: ['Cloudy, 22°C'],
audioUrl: 'assets/audio/weather_forecast.mp3',
explanation: 'The forecast mentions cloudy weather with 22 degrees.',
points: 1,
timeLimit: 45,
),
TestQuestion(
id: 'listening_004',
type: QuestionType.listening,
skillType: SkillType.listening,
difficulty: DifficultyLevel.upperIntermediate,
content: 'Listen to the academic lecture and identify the main topic:',
options: [
'Renewable energy sources',
'Climate change effects',
'Economic policy',
'Educational reform'
],
correctAnswers: ['Renewable energy sources'],
audioUrl: 'assets/audio/academic_lecture.mp3',
explanation: 'The lecture focuses on various renewable energy technologies.',
points: 3,
timeLimit: 120,
),
// 更多口语题目
TestQuestion(
id: 'speaking_003',
type: QuestionType.speaking,
skillType: SkillType.speaking,
difficulty: DifficultyLevel.elementary,
content: 'Describe your hometown. Include information about its location, population, and main attractions.',
options: [],
correctAnswers: [],
explanation: 'Use descriptive adjectives and present tense. Organize your response logically.',
points: 3,
timeLimit: 150,
),
TestQuestion(
id: 'speaking_004',
type: QuestionType.speaking,
skillType: SkillType.speaking,
difficulty: DifficultyLevel.upperIntermediate,
content: 'Express your opinion on remote work. Discuss both advantages and disadvantages.',
options: [],
correctAnswers: [],
explanation: 'Present balanced arguments and use appropriate linking words.',
points: 4,
timeLimit: 240,
),
// 更多写作题目
TestQuestion(
id: 'writing_002',
type: QuestionType.writing,
skillType: SkillType.writing,
difficulty: DifficultyLevel.intermediate,
content: 'Write an email (100-150 words) to your friend describing a recent trip you took.',
options: [],
correctAnswers: [],
explanation: 'Use informal tone, past tense, and descriptive language.',
points: 6,
timeLimit: 450,
),
TestQuestion(
id: 'writing_003',
type: QuestionType.writing,
skillType: SkillType.writing,
difficulty: DifficultyLevel.upperIntermediate,
content: 'Write an argumentative essay (200-250 words) about the benefits and drawbacks of social media.',
options: [],
correctAnswers: [],
explanation: 'Include introduction, body paragraphs with examples, and conclusion.',
points: 8,
timeLimit: 600,
),
TestQuestion(
id: 'writing_002',
type: QuestionType.writing,
skillType: SkillType.writing,
difficulty: DifficultyLevel.intermediate,
content: 'Write an essay (150-200 words) about the advantages and disadvantages of social media.',
options: [],
correctAnswers: [],
explanation: 'Present balanced arguments with clear structure.',
points: 8,
timeLimit: 600,
),
];
/// 测试模板静态数据
static final List<TestTemplate> _templates = [
TestTemplate(
id: 'template_quick',
name: '快速测试',
description: '15分钟快速评估包含基础词汇和语法题目',
type: TestType.quick,
duration: 15,
totalQuestions: 10,
skillDistribution: {
SkillType.vocabulary: 5,
SkillType.grammar: 3,
SkillType.reading: 2,
},
difficultyDistribution: {
DifficultyLevel.beginner: 4,
DifficultyLevel.elementary: 4,
DifficultyLevel.intermediate: 2,
},
questionIds: [
'vocab_001', 'vocab_002', 'grammar_001', 'grammar_002',
'reading_001', 'vocab_003', 'grammar_003', 'reading_002',
'listening_001', 'speaking_001'
],
createdAt: DateTime.now().subtract(const Duration(days: 30)),
updatedAt: DateTime.now().subtract(const Duration(days: 1)),
),
TestTemplate(
id: 'template_standard',
name: '标准测试',
description: '45分钟标准测试全面评估英语水平',
type: TestType.standard,
duration: 45,
totalQuestions: 25,
skillDistribution: {
SkillType.vocabulary: 6,
SkillType.grammar: 6,
SkillType.reading: 5,
SkillType.listening: 4,
SkillType.speaking: 2,
SkillType.writing: 2,
},
difficultyDistribution: {
DifficultyLevel.beginner: 5,
DifficultyLevel.elementary: 8,
DifficultyLevel.intermediate: 8,
DifficultyLevel.upperIntermediate: 3,
DifficultyLevel.advanced: 1,
},
questionIds: [
'vocab_001', 'vocab_002', 'vocab_004', 'grammar_001', 'grammar_002', 'grammar_004',
'reading_001', 'reading_003', 'listening_001', 'listening_003',
'speaking_001', 'speaking_003', 'writing_001', 'writing_002',
'vocab_003', 'vocab_005', 'grammar_003', 'grammar_005',
'reading_002', 'reading_004', 'listening_002', 'listening_004',
'speaking_002', 'speaking_004', 'writing_003'
],
createdAt: DateTime.now().subtract(const Duration(days: 25)),
updatedAt: DateTime.now().subtract(const Duration(days: 2)),
),
TestTemplate(
id: 'template_full',
name: '完整测试',
description: '90分钟完整测试深度评估所有技能',
type: TestType.full,
duration: 90,
totalQuestions: 50,
skillDistribution: {
SkillType.vocabulary: 10,
SkillType.grammar: 10,
SkillType.reading: 10,
SkillType.listening: 8,
SkillType.speaking: 6,
SkillType.writing: 6,
},
difficultyDistribution: {
DifficultyLevel.beginner: 8,
DifficultyLevel.elementary: 12,
DifficultyLevel.intermediate: 15,
DifficultyLevel.upperIntermediate: 10,
DifficultyLevel.advanced: 4,
DifficultyLevel.expert: 1,
},
questionIds: List.generate(50, (index) => 'question_${index + 1}'),
createdAt: DateTime.now().subtract(const Duration(days: 20)),
updatedAt: DateTime.now().subtract(const Duration(days: 3)),
),
TestTemplate(
id: 'template_mock',
name: '模拟考试',
description: '120分钟模拟真实考试环境',
type: TestType.mock,
duration: 120,
totalQuestions: 60,
skillDistribution: {
SkillType.vocabulary: 12,
SkillType.grammar: 12,
SkillType.reading: 12,
SkillType.listening: 10,
SkillType.speaking: 7,
SkillType.writing: 7,
},
difficultyDistribution: {
DifficultyLevel.beginner: 5,
DifficultyLevel.elementary: 10,
DifficultyLevel.intermediate: 20,
DifficultyLevel.upperIntermediate: 15,
DifficultyLevel.advanced: 8,
DifficultyLevel.expert: 2,
},
questionIds: [
// 重复使用现有题目来达到60题的要求
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006',
'grammar_001', 'grammar_002', 'grammar_003', 'grammar_004', 'grammar_005', 'grammar_006',
'reading_001', 'reading_002', 'reading_003', 'reading_004',
'listening_001', 'listening_002', 'listening_003', 'listening_004',
'speaking_001', 'speaking_002', 'speaking_003', 'speaking_004',
'writing_001', 'writing_002', 'writing_003',
// 重复一些题目
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006',
'grammar_001', 'grammar_002', 'grammar_003', 'grammar_004', 'grammar_005', 'grammar_006',
'reading_001', 'reading_002', 'reading_003', 'reading_004',
'listening_001', 'listening_002', 'listening_003', 'listening_004',
'speaking_001', 'speaking_002', 'speaking_003', 'speaking_004',
'writing_001', 'writing_002', 'writing_003',
// 再次重复以达到60题
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006'
],
createdAt: DateTime.now().subtract(const Duration(days: 15)),
updatedAt: DateTime.now().subtract(const Duration(days: 1)),
),
// 添加专项测试模板
TestTemplate(
id: 'template_vocabulary',
name: '词汇专项测试',
description: '30分钟专注词汇能力评估',
type: TestType.vocabulary,
duration: 30,
totalQuestions: 20,
skillDistribution: {
SkillType.vocabulary: 20,
},
difficultyDistribution: {
DifficultyLevel.beginner: 5,
DifficultyLevel.elementary: 6,
DifficultyLevel.intermediate: 5,
DifficultyLevel.upperIntermediate: 3,
DifficultyLevel.advanced: 1,
},
questionIds: [
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006',
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006',
'vocab_001', 'vocab_002', 'vocab_003', 'vocab_004', 'vocab_005', 'vocab_006',
'vocab_001', 'vocab_002'
],
createdAt: DateTime.now().subtract(const Duration(days: 10)),
updatedAt: DateTime.now().subtract(const Duration(hours: 12)),
),
TestTemplate(
id: 'template_grammar',
name: '语法专项测试',
description: '30分钟专注语法能力评估',
type: TestType.grammar,
duration: 30,
totalQuestions: 20,
skillDistribution: {
SkillType.grammar: 20,
},
difficultyDistribution: {
DifficultyLevel.beginner: 5,
DifficultyLevel.elementary: 6,
DifficultyLevel.intermediate: 5,
DifficultyLevel.upperIntermediate: 3,
DifficultyLevel.advanced: 1,
},
questionIds: [
'grammar_001', 'grammar_002', 'grammar_003', 'grammar_004', 'grammar_005', 'grammar_006',
'grammar_001', 'grammar_002', 'grammar_003', 'grammar_004', 'grammar_005', 'grammar_006',
'grammar_001', 'grammar_002', 'grammar_003', 'grammar_004', 'grammar_005', 'grammar_006',
'grammar_001', 'grammar_002'
],
createdAt: DateTime.now().subtract(const Duration(days: 8)),
updatedAt: DateTime.now().subtract(const Duration(hours: 6)),
),
TestTemplate(
id: 'template_reading',
name: '阅读理解专项测试',
description: '45分钟专注阅读理解能力评估',
type: TestType.reading,
duration: 45,
totalQuestions: 15,
skillDistribution: {
SkillType.reading: 15,
},
difficultyDistribution: {
DifficultyLevel.elementary: 4,
DifficultyLevel.intermediate: 5,
DifficultyLevel.upperIntermediate: 4,
DifficultyLevel.advanced: 2,
},
questionIds: [
'reading_001', 'reading_002', 'reading_003', 'reading_004',
'reading_001', 'reading_002', 'reading_003', 'reading_004',
'reading_001', 'reading_002', 'reading_003', 'reading_004',
'reading_001', 'reading_002', 'reading_003'
],
createdAt: DateTime.now().subtract(const Duration(days: 12)),
updatedAt: DateTime.now().subtract(const Duration(hours: 18)),
),
];
/// 测试结果静态数据
static final List<TestResult> _results = [
TestResult(
id: 'result_001',
testId: 'template_quick',
userId: 'user_001',
testType: TestType.quick,
totalScore: 8,
maxScore: 10,
percentage: 80.0,
overallLevel: DifficultyLevel.elementary,
skillScores: [
SkillScore(
skillType: SkillType.vocabulary,
score: 4,
maxScore: 5,
percentage: 80.0,
level: DifficultyLevel.elementary,
feedback: '词汇掌握良好,建议继续扩充词汇量',
),
SkillScore(
skillType: SkillType.grammar,
score: 2,
maxScore: 3,
percentage: 66.7,
level: DifficultyLevel.beginner,
feedback: '语法基础需要加强,多练习时态和句型',
),
SkillScore(
skillType: SkillType.reading,
score: 2,
maxScore: 2,
percentage: 100.0,
level: DifficultyLevel.intermediate,
feedback: '阅读理解能力优秀',
),
],
answers: [],
startTime: DateTime.now().subtract(const Duration(days: 7, hours: 2)),
endTime: DateTime.now().subtract(const Duration(days: 7, hours: 1, minutes: 45)),
duration: 900, // 15分钟
feedback: '总体表现良好,建议重点提升语法技能',
recommendations: {
'nextLevel': 'elementary',
'focusAreas': ['grammar', 'vocabulary'],
'suggestedStudyTime': 30,
},
),
TestResult(
id: 'result_002',
testId: 'template_standard',
userId: 'user_001',
testType: TestType.standard,
totalScore: 18,
maxScore: 25,
percentage: 72.0,
overallLevel: DifficultyLevel.elementary,
skillScores: [
SkillScore(
skillType: SkillType.vocabulary,
score: 5,
maxScore: 6,
percentage: 83.3,
level: DifficultyLevel.intermediate,
feedback: '词汇水平较好',
),
SkillScore(
skillType: SkillType.grammar,
score: 4,
maxScore: 6,
percentage: 66.7,
level: DifficultyLevel.elementary,
feedback: '语法需要加强',
),
SkillScore(
skillType: SkillType.reading,
score: 4,
maxScore: 5,
percentage: 80.0,
level: DifficultyLevel.elementary,
feedback: '阅读理解良好',
),
SkillScore(
skillType: SkillType.listening,
score: 3,
maxScore: 4,
percentage: 75.0,
level: DifficultyLevel.elementary,
feedback: '听力理解不错',
),
SkillScore(
skillType: SkillType.speaking,
score: 1,
maxScore: 2,
percentage: 50.0,
level: DifficultyLevel.beginner,
feedback: '口语表达需要大量练习',
),
SkillScore(
skillType: SkillType.writing,
score: 1,
maxScore: 2,
percentage: 50.0,
level: DifficultyLevel.beginner,
feedback: '写作技能需要提升',
),
],
answers: [],
startTime: DateTime.now().subtract(const Duration(days: 3, hours: 1)),
endTime: DateTime.now().subtract(const Duration(days: 3, minutes: 15)),
duration: 2700, // 45分钟
feedback: '整体水平为初级,建议加强语法、口语和写作练习',
recommendations: {
'nextLevel': 'intermediate',
'focusAreas': ['grammar', 'speaking', 'writing'],
'suggestedStudyTime': 60,
},
),
TestResult(
id: 'result_003',
testId: 'template_quick',
userId: 'user_001',
testType: TestType.quick,
totalScore: 9,
maxScore: 10,
percentage: 90.0,
overallLevel: DifficultyLevel.intermediate,
skillScores: [
SkillScore(
skillType: SkillType.vocabulary,
score: 5,
maxScore: 5,
percentage: 100.0,
level: DifficultyLevel.intermediate,
feedback: '词汇掌握优秀',
),
SkillScore(
skillType: SkillType.grammar,
score: 3,
maxScore: 3,
percentage: 100.0,
level: DifficultyLevel.intermediate,
feedback: '语法掌握良好',
),
SkillScore(
skillType: SkillType.reading,
score: 1,
maxScore: 2,
percentage: 50.0,
level: DifficultyLevel.elementary,
feedback: '阅读理解需要提升',
),
],
answers: [],
startTime: DateTime.now().subtract(const Duration(days: 1, hours: 2)),
endTime: DateTime.now().subtract(const Duration(days: 1, hours: 1, minutes: 45)),
duration: 900, // 15分钟
feedback: '进步明显,继续保持',
recommendations: {
'nextLevel': 'intermediate',
'focusAreas': ['reading'],
'suggestedStudyTime': 45,
},
),
];
/// 获取所有测试模板
static List<TestTemplate> getAllTemplates() {
return List.from(_templates);
}
/// 根据类型获取测试模板
static List<TestTemplate> getTemplatesByType(TestType type) {
return _templates.where((template) => template.type == type).toList();
}
/// 根据ID获取测试模板
static TestTemplate? getTemplateById(String id) {
try {
return _templates.firstWhere((template) => template.id == id);
} catch (e) {
return null;
}
}
/// 获取所有题目
static List<TestQuestion> getAllQuestions() {
return List.from(_questions);
}
/// 根据技能类型获取题目
static List<TestQuestion> getQuestionsBySkill(SkillType skillType) {
return _questions.where((q) => q.skillType == skillType).toList();
}
/// 根据难度获取题目
static List<TestQuestion> getQuestionsByDifficulty(DifficultyLevel difficulty) {
return _questions.where((q) => q.difficulty == difficulty).toList();
}
/// 根据ID列表获取题目
static List<TestQuestion> getQuestionsByIds(List<String> ids) {
return _questions.where((q) => ids.contains(q.id)).toList();
}
/// 根据ID获取单个题目
static TestQuestion? getQuestionById(String id) {
try {
return _questions.firstWhere((q) => q.id == id);
} catch (e) {
return null;
}
}
/// 获取用户测试结果
static List<TestResult> getUserResults(String userId) {
return _results.where((result) => result.userId == userId).toList();
}
/// 获取最近的测试结果
static List<TestResult> getRecentResults(String userId, {int limit = 5}) {
final userResults = getUserResults(userId);
userResults.sort((a, b) => b.endTime.compareTo(a.endTime));
return userResults.take(limit).toList();
}
/// 根据ID获取测试结果
static TestResult? getResultById(String id) {
try {
return _results.firstWhere((result) => result.id == id);
} catch (e) {
return null;
}
}
/// 获取技能统计
static Map<SkillType, double> getSkillStatistics(String userId) {
final userResults = getUserResults(userId);
if (userResults.isEmpty) return {};
final skillAverages = <SkillType, List<double>>{};
for (final result in userResults) {
for (final skillScore in result.skillScores) {
skillAverages.putIfAbsent(skillScore.skillType, () => []);
skillAverages[skillScore.skillType]!.add(skillScore.percentage);
}
}
return skillAverages.map((skill, scores) {
final average = scores.reduce((a, b) => a + b) / scores.length;
return MapEntry(skill, average);
});
}
/// 获取难度分布统计
static Map<DifficultyLevel, int> getDifficultyStatistics() {
final distribution = <DifficultyLevel, int>{};
for (final question in _questions) {
distribution[question.difficulty] =
(distribution[question.difficulty] ?? 0) + 1;
}
return distribution;
}
/// 获取技能分布统计
static Map<SkillType, int> getSkillDistributionStatistics() {
final distribution = <SkillType, int>{};
for (final question in _questions) {
distribution[question.skillType] =
(distribution[question.skillType] ?? 0) + 1;
}
return distribution;
}
/// 创建新的测试会话
static TestSession createTestSession({
required String templateId,
required String userId,
}) {
final template = getTemplateById(templateId);
if (template == null) {
throw Exception('Template not found: $templateId');
}
final questions = getQuestionsByIds(template.questionIds);
return TestSession(
id: 'session_${DateTime.now().millisecondsSinceEpoch}',
templateId: templateId,
userId: userId,
status: TestStatus.notStarted,
questions: questions,
answers: [],
currentQuestionIndex: 0,
startTime: DateTime.now(),
timeRemaining: template.duration * 60, // 转换为秒
);
}
/// 添加测试结果
static void addTestResult(TestResult result) {
_results.add(result);
}
/// 更新测试结果
static bool updateTestResult(String id, TestResult updatedResult) {
final index = _results.indexWhere((result) => result.id == id);
if (index != -1) {
_results[index] = updatedResult;
return true;
}
return false;
}
/// 删除测试结果
static bool deleteTestResult(String id) {
final index = _results.indexWhere((result) => result.id == id);
if (index != -1) {
_results.removeAt(index);
return true;
}
return false;
}
}