Error while rendering on the paid course page after change default currency on ecommerce

@regis

I needed to change the ecommerce currency of my tutor (juniper) instance.

I changed the configuration in the file:

ECOMMERCE_CURRENCY: BRL

When restarting the installation it is no longer possible to open the page about the courses (where the purchase option is)

The following error appears in the log

lms_1               | Traceback (most recent call last):
rabbitmq_1          | closing AMQP connection <0.750.0> (172.18.0.11:40730 -> 172.18.0.4:5672, vhost: '/', user: 'guest')
lms_1               |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
lms_1               |     response = get_response(request)
lms_1               |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
lms_1               |     response = self.process_exception_by_middleware(e, request)
lms_1               |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
lms_1               |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1               |   File "/opt/pyenv/versions/3.5.9/lib/python3.5/contextlib.py", line 30, in inner
lms_1               |     return func(*args, **kwds)
lms_1               |   File "/openedx/venv/lib/python3.5/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
lms_1               |     response = view_func(request, *args, **kwargs)
lms_1               |   File "/openedx/edx-platform/common/djangoapps/util/views.py", line 46, in inner
lms_1               |     response = view_func(request, *args, **kwargs)
lms_1               |   File "/openedx/edx-platform/common/djangoapps/util/cache.py", line 84, in wrapper
lms_1               |     response = view_func(request, *args, **kwargs)
lms_1               |   File "/openedx/edx-platform/lms/djangoapps/courseware/views/views.py", line 931, in course_about
lms_1               |     registration_price, course_price = get_course_prices(course)
lms_1               |   File "/openedx/edx-platform/common/djangoapps/course_modes/models.py", line 855, in get_course_prices
lms_1               |     settings.PAID_COURSE_REGISTRATION_CURRENCY[0]
lms_1               |   File "/openedx/edx-platform/common/djangoapps/course_modes/models.py", line 770, in min_course_price_for_currency
lms_1               |     return min(mode.min_price for mode in modes if mode.currency.lower() == currency.lower(),default=0)
lms_1               | ValueError: min() arg is an empty sequence
lms_1               | 10.10.8.5 - - [29/Sep/2020:23:28:22 +0000] "GET /courses/course-v1:UFMT+TAP1+2020ED1/about HTTP/1.0" 500 10113 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36"

Are there any further steps that should be taken after changing the currency of an EDX instance?

Tks

I solved the problem. Adding PAID_COURSE_REGISTRATION_CURRENCY and currency ISO symbol and id on lms.env.json

I made a tutor plugin to do this

Hi @ejklock! This looks like a bug. Thanks for identifying it and providing the solution :slight_smile: It will be fixed in the next release of the ecommerce plugin (v10.1.6).

Hello we tried to apply the tutor version but we finally had to apply the patch because it didn’t work. We have a new problem now, if the course is not registered on the ecommerce platform it doesn’t work an error 500 is displayed. and this error comes back again

return min(mode.min_price for mode in modes if mode.currency.lower() == currency.lower(),default=0)