Skip to content

Conversation

@Waleed-Mujahid
Copy link
Member

Description

This update passes passed_timestamp CourseGradeFactory so it can be used by figures. Previously we were querying PersistentCourseGrade which was a lot of unnecessary overhead. Since this code executes on every learner for every course for every site. that is a lot of queries we can avoid this way.

Legacy Figures changes

def course_grade(learner, course):
    """
    Compatibility function to retrieve course grades

    Returns the course grade for the specified learner and course
    """
    if RELEASE_LINE == 'ginkgo':
        course_grade = CourseGradeFactory().create(learner, course)
    else:  # Assume Hawthorn or greater
        course_grade = CourseGradeFactory().read(learner, course)

    persistent_course_grade = PersistentCourseGrade.objects.filter(user_id=learner.id, course_id=course.id).using(read_replica_or_default()).order_by('-modified').first()
    course_grade.passed_timestamp = persistent_course_grade.passed_timestamp if persistent_course_grade else None
    return course_grade
    

Note: Above code was not copied into develop-teak while rebasing which is why this issue was brought to our attention. This code is from KOA.

This update introduces a new field, passed_timestamp, to both CourseGrade and CourseGradeFactory classes, enhancing the tracking of grade status updates.
@Waleed-Mujahid Waleed-Mujahid self-assigned this Dec 31, 2025
@Waleed-Mujahid
Copy link
Member Author

@muhammadali286 @Anas-hameed I suggest we merge this change into koa as well and benchmark performance. Will look good in our metrics

@Waleed-Mujahid Waleed-Mujahid changed the title feat: add passed_timestamp to CourseGradeFactory for figures jobs feat: add passed_timestamp to CourseGradeFactory for figures Dec 31, 2025
Copy link

@Anas-hameed Anas-hameed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Waleed-Mujahid Waleed-Mujahid merged commit 7b27253 into develop-teak.3 Dec 31, 2025
16 of 48 checks passed
@Waleed-Mujahid Waleed-Mujahid deleted the waleed/8086 branch December 31, 2025 10:21
Anas-hameed pushed a commit that referenced this pull request Jan 19, 2026
This update introduces a new field, passed_timestamp, to both CourseGrade and CourseGradeFactory classes, enhancing the tracking of grade status updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants