Skip to content

Commit a75816e

Browse files
committed
feat: pull latest development changes
2 parents d6159d4 + 0687b5c commit a75816e

95 files changed

Lines changed: 5986 additions & 3769 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

create-tasks-for-current-user.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ async function createTasksForCurrentUser() {
2626
const lessonPlans = await LessonPlan.find({});
2727
const students = await UserProfile.find({});
2828

29-
console.log(`Found: ${subjects.length} subjects, ${atoms.length} atoms, ${lessonPlans.length} lesson plans, ${students.length} students`);
29+
console.log(
30+
`Found: ${subjects.length} subjects, ${atoms.length} atoms, ${lessonPlans.length} lesson plans, ${students.length} students`,
31+
);
3032

31-
if (subjects.length === 0 || atoms.length === 0 || lessonPlans.length === 0 || students.length === 0) {
33+
if (
34+
subjects.length === 0 ||
35+
atoms.length === 0 ||
36+
lessonPlans.length === 0 ||
37+
students.length === 0
38+
) {
3239
console.log('❌ Missing data. Need subjects, atoms, lesson plans, and students!');
3340
return;
3441
}
@@ -37,7 +44,7 @@ async function createTasksForCurrentUser() {
3744
await EducationTask.deleteMany({ studentId: currentUserId });
3845

3946
// Filter atoms to only use those with proper fields (subjectId and difficulty)
40-
const validAtoms = atoms.filter(atom => atom.subjectId && atom.difficulty);
47+
const validAtoms = atoms.filter((atom) => atom.subjectId && atom.difficulty);
4148
console.log(`Found ${validAtoms.length} atoms with proper fields (subjectId and difficulty)`);
4249

4350
if (validAtoms.length === 0) {
@@ -59,7 +66,7 @@ async function createTasksForCurrentUser() {
5966
grade: 'pending',
6067
feedback: null,
6168
suggestedTotalHours: 2,
62-
loggedHours: 0.5
69+
loggedHours: 0.5,
6370
},
6471
{
6572
lessonPlanId: lessonPlans[1] ? lessonPlans[1]._id : lessonPlans[0]._id,
@@ -74,7 +81,7 @@ async function createTasksForCurrentUser() {
7481
grade: 'A',
7582
feedback: 'Excellent work! Great understanding of the concepts.',
7683
suggestedTotalHours: 3,
77-
loggedHours: 3
84+
loggedHours: 3,
7885
},
7986
{
8087
lessonPlanId: lessonPlans[2] ? lessonPlans[2]._id : lessonPlans[0]._id,
@@ -88,7 +95,7 @@ async function createTasksForCurrentUser() {
8895
grade: 'pending',
8996
feedback: null,
9097
suggestedTotalHours: 4,
91-
loggedHours: 4
98+
loggedHours: 4,
9299
},
93100
{
94101
lessonPlanId: lessonPlans[0]._id,
@@ -103,7 +110,7 @@ async function createTasksForCurrentUser() {
103110
grade: 'B',
104111
feedback: 'Good effort, but review the algebraic concepts.',
105112
suggestedTotalHours: 1,
106-
loggedHours: 1
113+
loggedHours: 1,
107114
},
108115
{
109116
lessonPlanId: lessonPlans[1] ? lessonPlans[1]._id : lessonPlans[0]._id,
@@ -117,18 +124,19 @@ async function createTasksForCurrentUser() {
117124
grade: 'pending',
118125
feedback: null,
119126
suggestedTotalHours: 8,
120-
loggedHours: 0
121-
}
127+
loggedHours: 0,
128+
},
122129
]);
123130

124131
console.log(`✅ Created ${educationTasks.length} education tasks for current user`);
125132
console.log('🎯 Now try the API again!');
126-
133+
127134
// Log the created tasks for verification
128135
educationTasks.forEach((task, index) => {
129-
console.log(`Task ${index + 1}: ${task.type} - ${task.status} - Due: ${task.dueAt.toDateString()}`);
136+
console.log(
137+
`Task ${index + 1}: ${task.type} - ${task.status} - Due: ${task.dueAt.toDateString()}`,
138+
);
130139
});
131-
132140
} catch (error) {
133141
console.error('❌ Error:', error);
134142
} finally {
@@ -137,4 +145,4 @@ async function createTasksForCurrentUser() {
137145
}
138146
}
139147

140-
createTasksForCurrentUser();
148+
createTasksForCurrentUser();

0 commit comments

Comments
 (0)