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

Commit

Permalink
fix: Handle no web seat case for syncing job (#4177)
Browse files Browse the repository at this point in the history
* fix: Handle no web seat case on sync mobile seats job
  • Loading branch information
jawad-khan authored Jul 24, 2024
1 parent 7dc2fb6 commit f928e0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit f928e0d

Please sign in to comment.