New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: course progress url based on whether the user has learning MFE enabled (for master) #34344
base: master
Are you sure you want to change the base?
fix: course progress url based on whether the user has learning MFE enabled (for master) #34344
Conversation
Thanks for the pull request, @FatemeKhodayari! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
d564408
to
64653f3
Compare
7caba09
to
395085e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FatemeKhodayari changes look good to me, can you add a test case to validate the change also, then I think this looks good to merge.
Hi there -- just mentioning that this is on our radar too for review. I should be able to take a look shortly. |
Sure! I'll try to add the test by Saturday. |
395085e
to
8a1deb1
Compare
Hi @feanil! Just added the test. Please let me know if anything needs changing. |
8a1deb1
to
fad574f
Compare
@@ -224,6 +225,18 @@ def test_missing_resume_url(self): | |||
# Then the resumeUrl is None, which is allowed | |||
self.assertIsNone(output_data["resumeUrl"]) | |||
|
|||
def test_progress_url(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test won't always test the code we're trying to test, we should test both possibilities by mocking the course_home_mfe_progress_tab_is_active
so that it returns true and false and make sure that the correct expected URL is provided in either case.
See the quick guide if you haven't played with mocking before, and I'm happy to help if you're not sure how to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad. Had totally forgotten about mocking. I'll provide the fix by tomorrow or the day after. Thanks for the review and mentioning @feanil.
fad574f
to
5ceb5f1
Compare
Hi @feanil. Could you please have a look at this when possible? I last updated this repo about 3 week ago. Thanks in advance :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of final comments then this is good to merge. Soooo sorry for the slow review, the Python 3.11 upgrade ate up all my time.
""" | ||
if course_home_mfe_progress_tab_is_active: | ||
return f'{settings.LEARNING_MICROFRONTEND_URL}/course/{course_id}/progress' | ||
return f'/courses/{course_id}/progress' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return f'/courses/{course_id}/progress' | |
return reverse("progress", kwargs={"course_id": course_id}) |
You should use the reverse function here if possible.
:return: The course progress URL. | ||
""" | ||
if course_home_mfe_progress_tab_is_active: | ||
return f'{settings.LEARNING_MICROFRONTEND_URL}/course/{course_id}/progress' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return f'{settings.LEARNING_MICROFRONTEND_URL}/course/{course_id}/progress' | |
return get_learning_mfe_home_url(course_id, url_fragment='progress') |
Why not use the same underlying function, you're testing if the routing logic works so I don't see a reason to hardcode the URL here instead of using the function.
Currently, as we have in Quince, when a user hasn't passed the course, the "View Grades" link / button is displayed to him on the dashboard. Clicking on this link / button, takes the user to the old progress page. The URL of the old progress page is returned in the /api/learner_home/init response. In this change, course progress URL is returned based on whether the user has learning MFE enabled or not.
This issue was originally created in this forum topic and later discussed a little bit in the Maintenance WG meeting.
Closes #34323