Skip to content

Commit

Permalink
Merge pull request #559 from xzzy/master
Browse files Browse the repository at this point in the history
Bug Fix: new / change booking calendar bug
  • Loading branch information
dbca-asi committed Mar 13, 2019
2 parents f7c3025 + 5d113b2 commit 5fbb072
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mooring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,14 +1849,17 @@ def retrieve(self, request, pk=None, ratis_id=None, format=None, show_all=False)
# total_price = total_price +ms.amount
# current_booking.append(row)
booking_changed = True
if ongoing_booking.old_booking:

if ongoing_booking:
# When changing a book this check for changes
if ongoing_booking.old_booking is not None:

current_booking_obj = MooringsiteBooking.objects.filter(booking=ongoing_booking).values('campsite','from_dt','to_dt','booking_period_option')
old_booking_obj = MooringsiteBooking.objects.filter(booking=ongoing_booking.old_booking).values('campsite','from_dt','to_dt','booking_period_option')
# compare old and new booking for changes
if hashlib.md5(str(current_booking_obj)).hexdigest() == hashlib.md5(str(old_booking_obj)).hexdigest():
booking_changed = False

current_booking_obj = MooringsiteBooking.objects.filter(booking=ongoing_booking).values('campsite','from_dt','to_dt','booking_period_option')
old_booking_obj = MooringsiteBooking.objects.filter(booking=ongoing_booking.old_booking).values('campsite','from_dt','to_dt','booking_period_option')
# compare old and new booking for changes
if hashlib.md5(str(current_booking_obj)).hexdigest() == hashlib.md5(str(old_booking_obj)).hexdigest():
booking_changed = False

availability = utils.get_campsite_availability(sites_qs, start_date, end_date, ongoing_booking, request)
# create our result object, which will be returned as JSON
Expand Down

0 comments on commit 5fbb072

Please sign in to comment.