File size: 8,303 Bytes
da819ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
const mongoose = require('mongoose');
const SourceText = require('./models/SourceText');

// MongoDB connection
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb+srv://nothingyu:wSg3lbO1PkHiRMq9@sandbox.ecysggv.mongodb.net/?retryWrites=true&w=majority&appName=sandbox';

async function restoreWeek2Tasks() {
  try {
    console.log('🌐 Connecting to MongoDB...');
    await mongoose.connect(MONGODB_URI);
    console.log('βœ… Connected to MongoDB');

    // Original Week 2 tutorial tasks that should be restored
    const originalWeek2Tasks = [
      {
        title: 'Tutorial ST 1 - Week 2',
        content: 'The early bird catches the worm.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this proverb into Chinese, considering the visual elements in the image.',
        imageUrl: 'https://images.unsplash.com/photo-1444464666168-49d633b86797?w=800&h=600&fit=crop',
        imageAlt: 'A bird perched on a branch during sunrise'
      },
      {
        title: 'Tutorial ST 2 - Week 2',
        content: 'Actions speak louder than words.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context provided.',
        imageUrl: 'https://images.unsplash.com/photo-1557804506-669a67965ba0?w=800&h=600&fit=crop',
        imageAlt: 'People working together in a collaborative environment'
      },
      {
        title: 'Tutorial ST 3 - Week 2',
        content: 'A picture is worth a thousand words.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context of the image.',
        imageUrl: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600&fit=crop',
        imageAlt: 'A beautiful landscape photograph showing mountains and lake'
      },
      {
        title: 'Tutorial ST 4 - Week 2',
        content: 'Don\'t judge a book by its cover.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this proverb into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1544716278-ca5e3f4abd8c?w=800&h=600&fit=crop',
        imageAlt: 'An old book with a worn cover'
      },
      {
        title: 'Tutorial ST 5 - Week 2',
        content: 'Where there\'s a will, there\'s a way.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600&fit=crop',
        imageAlt: 'A mountain path leading to the summit'
      },
      {
        title: 'Tutorial ST 6 - Week 2',
        content: 'Practice makes perfect.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1557804506-669a67965ba0?w=800&h=600&fit=crop',
        imageAlt: 'Someone practicing a musical instrument'
      },
      {
        title: 'Tutorial ST 7 - Week 2',
        content: 'Better late than never.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1444464666168-49d633b86797?w=800&h=600&fit=crop',
        imageAlt: 'A clock showing late time'
      },
      {
        title: 'Tutorial ST 8 - Week 2',
        content: 'Look before you leap.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600&fit=crop',
        imageAlt: 'A person looking over a cliff edge'
      },
      {
        title: 'Tutorial ST 9 - Week 2',
        content: 'You can\'t teach an old dog new tricks.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1544716278-ca5e3f4abd8c?w=800&h=600&fit=crop',
        imageAlt: 'An older person learning something new'
      },
      {
        title: 'Tutorial ST 10 - Week 2',
        content: 'The grass is always greener on the other side.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600&fit=crop',
        imageAlt: 'A fence separating two fields of grass'
      },
      {
        title: 'Tutorial ST 11 - Week 2',
        content: 'Don\'t put all your eggs in one basket.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1557804506-669a67965ba0?w=800&h=600&fit=crop',
        imageAlt: 'Multiple baskets with eggs distributed among them'
      },
      {
        title: 'Tutorial ST 12 - Week 2',
        content: 'A stitch in time saves nine.',
        category: 'tutorial',
        weekNumber: 2,
        sourceLanguage: 'English',
        sourceCulture: 'Western',
        difficulty: 'intermediate',
        translationBrief: 'Translate this saying into Chinese, considering the visual context.',
        imageUrl: 'https://images.unsplash.com/photo-1444464666168-49d633b86797?w=800&h=600&fit=crop',
        imageAlt: 'Someone sewing a small tear in fabric'
      }
    ];

    console.log('πŸ”„ Restoring original 12 Week 2 tutorial tasks...');
    
    let restoredCount = 0;
    for (const task of originalWeek2Tasks) {
      // Check if this task already exists
      const existingTask = await SourceText.findOne({ 
        title: task.title,
        category: 'tutorial',
        weekNumber: 2
      });
      
      if (existingTask) {
        console.log(`⚠️  Task "${task.title}" already exists, skipping...`);
      } else {
        await SourceText.create(task);
        console.log(`βœ… Restored task: ${task.title}`);
        restoredCount++;
      }
    }

    console.log(`\nπŸŽ‰ RESTORE COMPLETE: Restored ${restoredCount} tasks`);
    console.log('πŸ“‹ All Week 2 tutorial tasks:');
    
    const allTasks = await SourceText.find({ 
      category: 'tutorial', 
      weekNumber: 2 
    }).sort({ title: 1 });
    
    allTasks.forEach((task, index) => {
      console.log(`${index + 1}. ${task.title}`);
      console.log(`   Image: ${task.imageUrl || 'No image'}`);
    });

    console.log(`\nπŸ“Š Total Week 2 tutorial tasks: ${allTasks.length}`);

  } catch (error) {
    console.error('❌ Error restoring Week 2 tasks:', error);
    process.exit(1);
  } finally {
    await mongoose.disconnect();
    console.log('πŸ”Œ Disconnected from MongoDB');
  }
}

// Run the restore
restoreWeek2Tasks();