Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

fix: Handle no web seat case for syncing job #4177

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ def handle(self, *args, **options):
attribute_values__value_text=CertificateType.VERIFIED,
).exclude(stockrecords__partner_sku__icontains="mobile").first()

if not web_seat:
logger.info('While syncing could not find web seat for %s', product.title)
continue

for mobile_seat in mobile_seats:
info = 'Syncing {} with {}'.format(mobile_seat.title, web_seat.title)
logger.info(info)
logger.info('Syncing %s with %s', mobile_seat.title, web_seat.title)

stock_record = mobile_seat.stockrecords.all()[0]
stock_record.price_excl_tax = web_seat.stockrecords.all()[0].price_excl_tax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def setUp(self):
self.course_with_audit_seat = self.create_course_and_seats(create_mobile_seats=False, create_web_seat=False)
self.course_with_unsync_seats = self.create_course_and_seats(create_mobile_seats=True, create_web_seat=True)
self.course_with_unsync_seats2 = self.create_course_and_seats(create_mobile_seats=True, create_web_seat=True)
self.course_with_mobile_seats = self.create_course_and_seats(create_mobile_seats=True, create_web_seat=True)
web_seat = self.get_web_seat_for_course(self.course_with_mobile_seats)
web_seat.delete()

mobile_seats = self.get_mobile_seats_for_course(self.course_with_unsync_seats)
mobile_seats = list(mobile_seats) + list(self.get_mobile_seats_for_course(self.course_with_unsync_seats2))

Expand Down
Loading