Luke Plant avatar Luke Plant committed e7c066a

Fixed test failure and bug with booking_problems_json

Comments (0)

Files changed (2)

cciw/bookings/tests.py

         self.assertEqual(json['account']['post_code'], 'ABC')
 
     def test_booking_problems(self):
+        self.add_prices()
         acc1 = BookingAccount.objects.create(email="foo@foo.com",
                                              post_code="ABC",
                                              name="Mr Foo")

cciw/bookings/views.py

         instance = form.save(commit=False)
         # We will get errors later on if prices don't exist for the year chosen, so
         # we check that first.
-        if not Price.objects.filter(year=instance.camp.year,
-                                    price_type=instance.price_type).exists():
+        if not is_booking_open(instance.camp.year):
             retval['problems'] = ['Prices have not been set for the year %d' % instance.camp.year]
         else:
             problems, warnings = instance.get_booking_problems(booking_sec=True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.