Skip to content

Commit b84b84d

Browse files
jfavellar90johanseto
authored andcommitted
Fix to prevent 500 error when course mode currency is not the same as the one configured from ansible settings
refactor: added default=0 to min function fix: added parenthesis to list generation refactor: deleted unnecesary try/except refactor: deleted list gunction into generator (cherry picked from commit 9d678442ab5ee6afc1240c6741e5cbb745fea246)
1 parent 223efd9 commit b84b84d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

common/djangoapps/course_modes/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,10 @@ def min_course_price_for_currency(cls, course_id, currency):
766766
If there is no mode found, will return the price of DEFAULT_MODE, which is 0
767767
"""
768768
modes = cls.modes_for_course(course_id)
769-
return min(mode.min_price for mode in modes if mode.currency.lower() == currency.lower())
769+
return min(
770+
(mode.min_price for mode in modes if mode.currency.lower() == currency.lower()),
771+
default=0
772+
)
770773

771774
@classmethod
772775
def is_eligible_for_certificate(cls, mode_slug, status=None):

0 commit comments

Comments
 (0)