credentials
credentials copied to clipboard
fix: download records without Segment setup
Fix the download records functionality when Segment is not used.
The user is getting the error if the platform has no Segment settings.
Preconditions
- The
segment_keysetting in the credentials site configurations is empty
STR
- Go to the records page, click "Share" and copy the sharing URL:

- Open the copied URL in the new tab or incognito window and click "Download":

Actual Result
User see the 500 error:
Error logs:
Traceback (most recent call last):
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/edx/app/credentials/credentials/credentials/apps/records/views.py", line 56, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/edx/app/credentials/credentials/credentials/apps/records/views.py", line 478, in get
segment_client = SegmentClient(write_key=site_configuration.segment_key)
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/analytics/client.py", line 60, in init
require('write_key', write_key, string_types)
File "/edx/app/credentials/venvs/credentials/lib/python3.8/site-packages/analytics/client.py", line 325, in require
raise AssertionError(msg)
AssertionError: write_key must have (<class 'str'>,), got: None
Expecting Result The user (or anonymous user) can download the CSV report.
Notes:
- Segment key is not the mandatory setting in the credentials site configuration
Thanks for the pull request, @dyudyunov! 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.
@natabene this one is ready for review 😉
@dyudyunov Thank you for your contribution. I will line up this for our review.
@hurtstotouchfire Hi Kelly! Could you please take a look at this?
This is in our next sprint, starting Monday. If it's approved within the 2 week sprint it can be merged. @dyudyunov if you can be available to respond to any review feedback during the next week or so that would be very helpful.
This is in our next sprint, starting Monday. If it's approved within the 2 week sprint it can be merged. @dyudyunov if you can be available to respond to any review feedback during the next week or so that would be very helpful.
Sure
@dyudyunov 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.