Skip to content

fix: calculate last_grade_publish_date for all unreleased subsections#37748

Open
asajjad2 wants to merge 1 commit intoopenedx:masterfrom
asajjad2:areeb/last-publish-grade-calc-update
Open

fix: calculate last_grade_publish_date for all unreleased subsections#37748
asajjad2 wants to merge 1 commit intoopenedx:masterfrom
asajjad2:areeb/last-publish-grade-calc-update

Conversation

@asajjad2
Copy link
Contributor

@asajjad2 asajjad2 commented Dec 11, 2025

What are the relevant tickets?

#9459

Description (What does it do?)

The last_grade_publish_date field for each section in the progress API was showing the current datetime instead of the actual grade release date when there were no unreleased subsections with show_correctness values of 'past_due' or 'never_but_include_grade'.

The original code only initialized last_grade_publish_date to now() and updated only when:

  1. show_correctness (Assessment result visibility) was in ['past_due', 'never_but_include_grade'] and
  2. The due date was greater than the current last_grade_publish_date

This PR updates the code to initialize last_grade_publish_date from now() to None

Testing Steps

  1. Create a course with subsections where:
    • All assignment due dates are in the past
    • Some have show_correctness=past_due or never_but_include_grade
  2. As a student, view the Progress page on the Learning MFE
  3. The Page should not show the warning Some assignment scores are not yet included in your total grade. These grades will be released by {current date}

@openedx-webhooks
Copy link

openedx-webhooks commented Dec 11, 2025

Thanks for the pull request, @asajjad2!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 11, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Dec 11, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Dec 11, 2025
@asajjad2 asajjad2 marked this pull request as ready for review December 11, 2025 14:07
Comment on lines +171 to +177
if subsection_grade.due:
should_update = (
bucket.last_grade_publish_date is None or
subsection_grade.due > bucket.last_grade_publish_date
)
if should_update:
bucket.last_grade_publish_date = subsection_grade.due
Copy link
Contributor

Choose a reason for hiding this comment

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

@asajjad2 could you add test(s) for this change?

@asajjad2 asajjad2 force-pushed the areeb/last-publish-grade-calc-update branch from 00b942b to 6bc3a2c Compare December 18, 2025 13:17
@Anas12091101 Anas12091101 self-requested a review January 7, 2026 11:05
@Anas12091101 Anas12091101 moved this from Waiting on Author to Ready for Review in Contributions Jan 7, 2026
Copy link
Contributor

@Anas12091101 Anas12091101 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines 191 to 198
if 'last_grade_publish_date_days' in expected:
expected_date = (
datetime.now(timezone.utc) +
timedelta(days=expected['last_grade_publish_date_days'])
)
assert row['last_grade_publish_date'] is not None
else:
assert row['last_grade_publish_date'] is None
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified to:

Suggested change
if 'last_grade_publish_date_days' in expected:
expected_date = (
datetime.now(timezone.utc) +
timedelta(days=expected['last_grade_publish_date_days'])
)
assert row['last_grade_publish_date'] is not None
else:
assert row['last_grade_publish_date'] is None
assert (row['last_grade_publish_date'] is not None) == (
'last_grade_publish_date_days' in expected
)

@asajjad2 asajjad2 force-pushed the areeb/last-publish-grade-calc-update branch from f5f8343 to c65e1fa Compare January 8, 2026 12:19
@pdpinch pdpinch requested a review from arslanashraf7 January 14, 2026 02:52
@asajjad2 asajjad2 force-pushed the areeb/last-publish-grade-calc-update branch from 743126a to bc7f8ed Compare January 14, 2026 13:00
@pdpinch
Copy link
Contributor

pdpinch commented Jan 15, 2026

@asajjad2 can you squash your commits and rebase?

@asajjad2 asajjad2 force-pushed the areeb/last-publish-grade-calc-update branch 2 times, most recently from b4e5502 to 658767f Compare January 16, 2026 13:29
@mphilbrick211 mphilbrick211 moved this from Ready for Review to In Eng Review in Contributions Jan 23, 2026
fix: don't update business logic

fix: comparison condition

fix: linting errors

fix: linting error

test: progress api test

test: add not-null scenario

fix: linting errors

test: fix assertion

refactor: tests
@asajjad2 asajjad2 force-pushed the areeb/last-publish-grade-calc-update branch from 658767f to b3b1c2c Compare February 17, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

5 participants