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 surveyreport questions #940

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

Alec4r
Copy link
Contributor

@Alec4r Alec4r commented Nov 14, 2023

DESCRIPTION

This PR creates a new hook Action that allows tutor plugins to interact with the configuration at the time of the interactive questionnaire that happens during tutor local launch.

REQUIRED PLUGINS

None. The creation of the Action does not require anything from new or existing plugins. Current plugins that do not use this action will see absolutely no changes to the functionality of tutor local launch.

MORE INFO

This Action was first needed when trying to create a plugin to send automatic and anonymized reports of usage.
For more context on that see:

EXAMPLE:

A plugin using this Action to add a new question can be seen at:
eduNEXT/tutor-contrib-surveyreport#1

Copy link

@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.

We need to refactor this as a new filter that other plugins can also build on top of

tutor/interactive.py Outdated Show resolved Hide resolved
tutor/interactive.py Outdated Show resolved Hide resolved
@@ -8,6 +8,8 @@ OPENEDX_SECRET_KEY: "{{ 24|random_string }}"
PLUGINS:
# The MFE plugin is required
- mfe
# SurveyReport plugin is required
- surveyreport

Choose a reason for hiding this comment

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

We can not allow the survey report to become a requirement for every tutor install. We have a proposal to make it part of tutor full, but first we need to finish up the plugin and make it completely optiona. Only then we can create a separate request to include it in https://github.com/overhangio/tutor/blob/master/requirements/plugins.txt

@felipemontoya
Copy link

@regisb we sat with @Alec4r in a call giving this PR a big refactor and we'd like you input about the ergonomics of the new Filter. This is probably the first filter that is being contributed so we could not find an example to draw from, so please forgive our lack of understanding.

We are looking at adding the filter at the end of the ask_questions function.

Option 1

would be to add something that lets passes the context to the filter and we expect the plugins to run the code that asks the questions. Something like:

at tutor core:

utils = [ask, ask_bool, ask_choice]
config = ASK_INTERACTIVE_QUESTIONS.apply(config, defaults, utils)

at the plugin:

@hooks.Filter.ASK_INTERACTIVE_QUESTIONS.add()
def cool_question_function(config, defaults, utils):

    utils.ask("do you want to automatically send a survey report to Axim every six months? pretty please :)", "AUTO_SEND_SURVEY_REPORT", config, defaults)

    return config

Option 2

would be to a control loop at the core that asks the question that are mostly string configured at the plugin.
Something like:

at tutor core:

 for item in hooks.Filter.ASK_INTERACTIVE_QUESTIONS.get_items():
    ask(item[2], item[3], config, defaults)

at the plugin:

hooks.Filters.ASK_INTERACTIVE_QUESTIONS.add_items(
    [
        (
            "surveyreport-namespace",
            "do you want to automatically send a survey report to Axim every six months? pretty please :)",
             "AUTO_SEND_SURVEY_REPORT",
        ),
        (
            "surveyreport-namespace",
            "Are you sure?",
             "AUTO_SEND_SURVEY_REPORT_CONFIRMATION",
        ),
    ]
)

Any and all guidance is very appreciated.

@regisb regisb self-assigned this Nov 21, 2023
@regisb regisb self-requested a review November 21, 2023 07:55
@regisb
Copy link
Contributor

regisb commented Nov 23, 2023

I think I may have put you on the wrong lead. Instead of a filter, maybe create a INTERACTIVE_CONFIGURATION action that would take as argument the current configuration?

@hooks.Action.INTERACTIVE_CONFIGURATION.add()
def _enable_surveyreport(config):
    utils.ask("...")
    ...

def ask_questions(config, run_for_prod):
    hooks.Action.INTERACTIVE_CONFIGURATION.do(config)

@regisb regisb assigned Alec4r and unassigned regisb Nov 23, 2023
@Alec4r Alec4r force-pushed the survey_report_plugin branch from 86c353a to a257753 Compare December 6, 2023 21:27
@Alec4r
Copy link
Contributor Author

Alec4r commented Dec 6, 2023

@regisb @felipemontoya I have added the actions to tutor core and also I openned a PR in surveyreport plugin eduNEXT/tutor-contrib-surveyreport#1 adding the questions.

Copy link

@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.

Thanks a lot @Alec4r. This is now very much in line with what I was expecting we needed to do in the core of tutor.

The intervention seems lightweight and has an explanation at the definition of the new Action. Would you please go ahead and review this @regisb?

@Alec4r I think we need to update the PR description to make clear that this is no longer surveyreport specific but it is only opening up a space for plugins to ask question during the interactive questionnaire.

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

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

Who doesn't love simplicity? Thanks @Alec4r! Can you please just add a changelog entry?

tutor/hooks/catalog.py Outdated Show resolved Hide resolved
@regisb
Copy link
Contributor

regisb commented Dec 14, 2023

Sorry about the delay guys, I was busy with the Quince release.

new hook Action that allows tutor plugins to interact with the configuration at the time of the interactive questionnaire that happens during tutor local launch
@Alec4r Alec4r force-pushed the survey_report_plugin branch from 9a2ab41 to 7660ead Compare December 14, 2023 19:21
@Alec4r
Copy link
Contributor Author

Alec4r commented Dec 14, 2023

Who doesn't love simplicity? Thanks @Alec4r! Can you please just add a changelog entry?

I think is done, let me know if you have another comment.

@regisb regisb merged commit afb85aa into overhangio:master Dec 15, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants