Skip to content
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

feat: add filter design to modify the instructor dashboard render #96

Merged
merged 3 commits into from
Jul 18, 2023

Conversation

mariajgrimaldi
Copy link
Member

@mariajgrimaldi mariajgrimaldi commented Jun 13, 2023

Description:
This PR adds a new filter to modify the instructor dashboard rendering process. For example: modify the section tabs of the instructor context --that specifies which tabs to render, adding a brand new one defined in a different plugin. The use case we're currently testing is to add a new tab to the instructor dashboard, which renders management information about an Xblock.

Installation instructions:
In case you want to test the use case shown here, you'll need a couple of stuff:

  1. Install the LimeSurvey Xblock in the LMS/CMS services: git+https:/eduNEXT/xblock-limesurvey.git@MJG/instructor-tab
  2. Install this branch in the LMS/CMS services: git+https:/openedx/openedx-filters.git@MJG/instructor-tab-filters
  3. Change your edx-platform branch to MJG/instructor-dashboard-filter
  4. Restart services

Testing instructions:

  1. Add the Open edX Filters configuration to your environment:
OPEN_EDX_FILTERS_CONFIG = {
    "org.openedx.learning.instructor.dashboard.render.started.v1": {
        "fail_silently": False,
        "pipeline": [
            "limesurvey.extensions.filters.AddInstructorLimesurveyTab",
        ]
    },
}
  1. Add the LimeSurvey xblock as a component of your course, you can use dummy values for the Studio configuration. The student view doesn't really matter for these tests.
  2. Go to the instructor dashboard with the proper permissions (as an instructor of the course). You'll see:
    Screenshot from 2023-06-13 16-21-22

Reviewers:

Merge checklist:

  • All reviewers approved
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed

Post merge:

  • Create a tag
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)

@openedx-webhooks openedx-webhooks added core committer open-source-contribution PR author is not from Axim or 2U labels Jun 13, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 13, 2023

Thanks for the pull request, @mariajgrimaldi!

As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion.

@mariajgrimaldi mariajgrimaldi marked this pull request as ready for review June 13, 2023 22:05
@mariajgrimaldi mariajgrimaldi requested a review from a team as a code owner June 13, 2023 22:05
Comment on lines 601 to 651
class RedirectToPage(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard process.
"""

def __init__(self, message, redirect_to=""):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
redirect_to: URL to redirect to.
"""
super().__init__(message, redirect_to=redirect_to)

class RenderInvalidDashboard(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard render process.
"""

def __init__(self, message, dashboard_template="", template_context=None):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
dashboard_template: template path rendered instead.
template_context: context used to the new dashboard_template.
"""
super().__init__(
message,
dashboard_template=dashboard_template,
template_context=template_context,
)

class RenderCustomResponse(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard rendering process.
"""

def __init__(self, message, response=None):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
response: custom response which will be returned by the dashboard view.
"""
super().__init__(
message,
response=response,
Copy link
Member Author

Choose a reason for hiding this comment

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

[curious about other opinions] I wonder if these exceptions are needed in this case, is this a question we should ask every time we add a filter that interacts with templates? Or should we always add the same exceptions for them?

Copy link
Member

Choose a reason for hiding this comment

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

I like the predictability of always having the same exceptions. As a dev I'd like to have an idea of what I can expect of a filter that is *.render.started.v1.

In this case I personally would rather try to use such filter for extending the instructor dashboard capabilities and not to replace them altogether, but the filter should be agnostic to that. I can imagine all sort of uses for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good! This is a good time to standardize all these types of things. I'll make a mental note to add it to the ongoing docs work :)

"""
super().__init__(
message,
dashboard_template=dashboard_template,
Copy link
Member Author

Choose a reason for hiding this comment

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

[seeking advice] I used dashboard_template instead of instructor_dashboard_template, is it confusing?

Copy link
Member

Choose a reason for hiding this comment

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

I also think it can be easily confused with the student dashboard. However instructor_dashboard_template seems like unnecessary long.

We could use the same compromise the platform used and go with instructor_template. I think it conveys the most critical part of the info.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! That's what I needed.

Custom class used to create instructor dashboard filters and its custom methods.
"""

filter_type = "org.openedx.learning.instructor.dashboard.render.started.v1"
Copy link
Member Author

Choose a reason for hiding this comment

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

[seeking advice] should we use: org.openedx.learning.instructor_dashboard.render.started.v1 instead?

Copy link
Member

Choose a reason for hiding this comment

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

We have used "." for separating "course.enrollment" in the past. I think here it's the same kind of separation and thus "." is correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same here for the docs! Thanks for the help :)

@mariajgrimaldi
Copy link
Member Author

cc @felipemontoya when you have a chance ;)

@mariajgrimaldi mariajgrimaldi requested review from felipemontoya and removed request for a team June 16, 2023 16:11
Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

I reviewed this together with https:/openedx/edx-platform/pull/32448/files and I think this filter works as expected.

There is a nit about naming one of the variables but once that is fixed this looks like its good to be merged. I leave my approval already.

Custom class used to create instructor dashboard filters and its custom methods.
"""

filter_type = "org.openedx.learning.instructor.dashboard.render.started.v1"
Copy link
Member

Choose a reason for hiding this comment

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

We have used "." for separating "course.enrollment" in the past. I think here it's the same kind of separation and thus "." is correct.

"""
super().__init__(
message,
dashboard_template=dashboard_template,
Copy link
Member

Choose a reason for hiding this comment

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

I also think it can be easily confused with the student dashboard. However instructor_dashboard_template seems like unnecessary long.

We could use the same compromise the platform used and go with instructor_template. I think it conveys the most critical part of the info.

Comment on lines 601 to 651
class RedirectToPage(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard process.
"""

def __init__(self, message, redirect_to=""):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
redirect_to: URL to redirect to.
"""
super().__init__(message, redirect_to=redirect_to)

class RenderInvalidDashboard(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard render process.
"""

def __init__(self, message, dashboard_template="", template_context=None):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
dashboard_template: template path rendered instead.
template_context: context used to the new dashboard_template.
"""
super().__init__(
message,
dashboard_template=dashboard_template,
template_context=template_context,
)

class RenderCustomResponse(OpenEdxFilterException):
"""
Custom class used to stop the instructor dashboard rendering process.
"""

def __init__(self, message, response=None):
"""
Override init that defines specific arguments used in the instructor dashboard render process.

Arguments:
message: error message for the exception.
response: custom response which will be returned by the dashboard view.
"""
super().__init__(
message,
response=response,
Copy link
Member

Choose a reason for hiding this comment

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

I like the predictability of always having the same exceptions. As a dev I'd like to have an idea of what I can expect of a filter that is *.render.started.v1.

In this case I personally would rather try to use such filter for extending the instructor dashboard capabilities and not to replace them altogether, but the filter should be agnostic to that. I can imagine all sort of uses for this.

Copy link
Member Author

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

Thanks for the review @felipemontoya, I'll merge this now.

@mariajgrimaldi mariajgrimaldi merged commit c982791 into main Jul 18, 2023
6 checks passed
@mariajgrimaldi mariajgrimaldi deleted the MJG/instructor-tab-filters branch July 18, 2023 15:44
@openedx-webhooks
Copy link

@mariajgrimaldi 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core committer open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants