Skip to content

Commit

Permalink
fix: fallback to 'price' in ecommerce api loader
Browse files Browse the repository at this point in the history
The Django Oscar upgrade of ecommerce changed the
item's price field from price_excl_tax to just price
causing the EcommerceApi data loader to fail.

This commit handles the exception and falls back to
the 'price' value.

Ref: openedx-unsupported/ecommerce#4050
  • Loading branch information
tecoholic authored Sep 25, 2024
2 parents 1bd0b54 + 198c47a commit f39b839
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
continue-on-error: ${{ matrix.status == 'ignored' }}
- name: Upload coverage
if: matrix.db-version == 'mysql80'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.pytest-split-group }}
path: .coverage
Expand Down
2 changes: 1 addition & 1 deletion course_discovery/apps/course_metadata/data_loaders/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def update_seats(self, body):
def update_seat(self, course_run, product_body):
stock_record = product_body['stockrecords'][0]
currency_code = stock_record['price_currency']
price = Decimal(stock_record['price_excl_tax'])
price = Decimal(stock_record.get('price_excl_tax', stock_record['price']))
sku = stock_record['partner_sku']

# For more context see ADR docs/decisions/0025-dont-sync-mobile-skus-on-discovery.rst
Expand Down

0 comments on commit f39b839

Please sign in to comment.