Skip to content

Commit

Permalink
Fix bug in g.learn
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa committed Apr 3, 2024
1 parent 1aa153a commit 7aab90e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/global/commands/g.learn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ export async function profile(

// Get an array of courses the user has completed
completedCourses = moodleEnrollments
.filter(enrollments => enrollments.enrol.course.completions[0].timecompleted !== null)
.map(enrollments => enrollments.enrol.course.fullname);
.filter(enrollment => enrollment.enrol.course.completions.length > 0 && enrollment.enrol.course.completions[0].timecompleted !== null)
.map(enrollment => enrollment.enrol.course.fullname);

incompleteCourses = moodleEnrollments
.filter(enrollments => enrollments.enrol.course.completions[0].timecompleted === null)
.map(enrollments => enrollments.enrol.course.fullname);
.filter(enrollment => enrollment.enrol.course.completions.length === 0 || enrollment.enrol.course.completions[0].timecompleted === null)
.map(enrollment => enrollment.enrol.course.fullname);
}

moodleProfile = {
Expand Down

0 comments on commit 7aab90e

Please sign in to comment.