Commit 8dc7e656 by Waheed Ahmed

Fixed course-run send for review if seat type is credit.

LEARNER-1250
parent 1fece291
...@@ -329,7 +329,7 @@ class CourseRun(TimeStampedModel, ChangedByMixin): ...@@ -329,7 +329,7 @@ class CourseRun(TimeStampedModel, ChangedByMixin):
""" """
Validate course-run has a valid seats. Validate course-run has a valid seats.
""" """
seats = self.seats.filter(type__in=[Seat.AUDIT, Seat.VERIFIED, Seat.PROFESSIONAL]) seats = self.seats.filter(type__in=[Seat.AUDIT, Seat.VERIFIED, Seat.PROFESSIONAL, Seat.CREDIT])
return all([seat.is_valid_seat for seat in seats]) if seats else False return all([seat.is_valid_seat for seat in seats]) if seats else False
...@@ -379,7 +379,7 @@ class Seat(TimeStampedModel, ChangedByMixin): ...@@ -379,7 +379,7 @@ class Seat(TimeStampedModel, ChangedByMixin):
return ( return (
self.type == self.AUDIT or self.type == self.AUDIT or
(self.type in [self.VERIFIED, self.PROFESSIONAL] and self.price > 0) or (self.type in [self.VERIFIED, self.PROFESSIONAL] and self.price > 0) or
(self.type == self.CREDIT and self.credit_price > 0) (self.type == self.CREDIT and self.credit_price > 0 and self.price > 0)
) )
......
...@@ -123,6 +123,15 @@ class CourseRunTests(TestCase): ...@@ -123,6 +123,15 @@ class CourseRunTests(TestCase):
self.assertTrue(self.course_run.has_valid_seats) self.assertTrue(self.course_run.has_valid_seats)
credit_seat = factories.SeatFactory(course_run=self.course_run, type=Seat.CREDIT, price=0, credit_price=0)
self.assertFalse(self.course_run.has_valid_seats)
credit_seat.price = 200
credit_seat.credit_price = 200
credit_seat.save()
self.assertTrue(self.course_run.has_valid_seats)
class CourseTests(TestCase): class CourseTests(TestCase):
""" Tests for the publisher `Course` model. """ """ Tests for the publisher `Course` model. """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment