Skip to content

feat: added banner message for survey report - #33633

Merged
felipemontoya merged 26 commits into
openedx:masterfrom
eduNEXT:ase/survey-report-message
Dec 18, 2023
Merged

feat: added banner message for survey report#33633
felipemontoya merged 26 commits into
openedx:masterfrom
eduNEXT:ase/survey-report-message

Conversation

@Asespinel

@Asespinel Asespinel commented Oct 31, 2023

Copy link
Copy Markdown
Contributor

This PR adds a custom banner message to the admin site. Right now the message only appears if a survey report hasn't been generated in 6 months but this threshold is configurable . Also this PR will send the report when it's generated as well.

How to test

  1. Ensure that your latest Survey Report generated is at least one month old (if you don't have any, then this should work as well). You can check your previous survey reports at /admin/survey_report/surveyreport/
  2. If you're a super user with access to the LMS admin dashboard, you should be able to see the banner message. In any site belonging to the admin site.
    Screenshot from 2023-11-02 15-00-44
  3. You can click on the "Send report" button to generate and send the report accordinly.
  4. A "thank you message" should confirm that the report was sent properly.
    Screenshot from 2023-11-02 15-06-10
  5. You can also click on the "Dismiss" button to hide the message.
  6. The newly generated report should appear at /admin/survey_report/surveyreport/
  7. The message should not appear again since the report was recently generated and sent.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 31, 2023
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @Asespinel! 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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

Comment thread openedx/features/survey_report/contex_processors.py Outdated
Comment thread lms/templates/admin/base.html Outdated
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 1, 2023
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base.html Outdated
Comment thread lms/templates/admin/base.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
@Asespinel

Copy link
Copy Markdown
Contributor Author

Thanks for all the suggestions @dcoa I'll update the templates accordingly

@mphilbrick211 mphilbrick211 removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 3, 2023
@mphilbrick211

Copy link
Copy Markdown

HI @Asespinel! Just flagging that there are some failing tests.

@Asespinel
Asespinel force-pushed the ase/survey-report-message branch from ff01956 to 21e4e49 Compare November 3, 2023 16:17
@Asespinel

Copy link
Copy Markdown
Contributor Author

Thanks for the heads up @mphilbrick211 I'll check on them

@Asespinel
Asespinel force-pushed the ase/survey-report-message branch from 21e4e49 to 14b41d5 Compare November 16, 2023 17:30
@Asespinel
Asespinel force-pushed the ase/survey-report-message branch from 14b41d5 to 9778c83 Compare November 16, 2023 18:31
@MaferMazu

Copy link
Copy Markdown
Contributor

We manually increase the number of queries to make the test pass; is there a better way? @ormsbee
Could you please help us review this?
Thanks in advance 🌟

@ormsbee

ormsbee commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

@MaferMazu: Incrementing the number like this is fine. The CCX test shouldn't be written to test query counts on an entire view load. Query counts should only be done on lower level things (like api.py functions) for precisely this reason. But it's not your obligation to fix the root issue–just incrementing by 1 as you're doing is fine. Thank you for checking in on it.

@Asespinel

Copy link
Copy Markdown
Contributor Author

Could you help me with a review of this PR? @mariajgrimaldi @felipemontoya @ormsbee . I think everything is working as expected but any feedback is welcomed. Let me know your thoughts on the matter.

@ormsbee ormsbee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mostly questions about whether we can simplify the Admin template.

Comment thread lms/templates/admin/base.html Outdated
Comment thread lms/templates/admin/base.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
Comment thread lms/templates/admin/base_site.html Outdated
@Asespinel

Copy link
Copy Markdown
Contributor Author

Hi @ormsbee I deleted the base.html file and made the changes acordingly to maje the code easier to read and understand. Please let me know if you have anymore suggestions

@ormsbee ormsbee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Asespinel: Thank you for the admin template simplifications–this looks much cleaner!

This looks good to me once commit messages are squashed. I have one suggestion, but it's optional.

from .models import SurveyReport


def admin_extra_context(request):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Random thought (completely optional): Is it easy to check if this request is for an admin view and return {'show_survey_report_banner': False} if it's not an admin view (without having to check the database)? In that case, you might be able to remove the changes that require bumping the number of queries in the other tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I implemented the change requested with this change we should revert back the query counts by 1 in all the tests? Or just on particular ones?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We will know for sure once the tests run completely but my guess is that for all of them.

@felipemontoya felipemontoya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work @Asespinel. I only have a minor request about the threshold

The current treshhold to show the banner is one month but this can be redefined in the future

"""
months = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should move this to a setting so that it is configurable and also put a better default. Since we would like to get reports about twice a year, we could set the default to 6.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback ioll change it to 6

The current treshhold to show the banner is one month but this can be redefined in the future

"""
months = 6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the change, but this is still a constant. I meant configuring this so that it reads from a variable. Similar to what happens here.

});
</script>

{% endblock %} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: EOL

@felipemontoya felipemontoya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the updates @Asespinel. I think this is good to be merged now.

@Asespinel

Copy link
Copy Markdown
Contributor Author

Hello @ormsbee, @felipemontoya if there's no more changes needed. Could you help me with the squash so we can close this PR?

@felipemontoya
felipemontoya merged commit e9d84d0 into openedx:master Dec 18, 2023
@openedx-webhooks

Copy link
Copy Markdown

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

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Alec4r pushed a commit to eduNEXT/edx-platform that referenced this pull request Feb 29, 2024
* feat: added banner message for survey report

* refactor: addressed PR feedback and changes
* fix: fixed styles on admin templates
* refactor: changed script location to survey report block
* chore: removed whitespaces and renamed the context processor files
* feat: added banner message for survey report
* refactor: separated survey report template from admin and deleted base template
* refactor: changed months variable into a configurable setting


---------

Co-authored-by: Maria Fernanda Magallanes Zubillaga <maria.magallanes@edunext.co>
Co-authored-by: María Fernanda Magallanes <35668326+MaferMazu@users.noreply.github.com>
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

Archived in project

Development

Successfully merging this pull request may close these issues.

9 participants