Fix consecutive slot booking issue, and UI issues#11
Fix consecutive slot booking issue, and UI issues#11CruiseDevice wants to merge 1 commit intoFOSSEE:devfrom
Conversation
CruiseDevice
commented
Dec 11, 2018
- Fix consecutive slot booking issue.
- Add Forum and Contact us in SBHSInfocenter dropdown.
- Disable Refresh button in show_video for 3 seconds.
| next_hour = dt.combine( | ||
| new_slot_date,time( | ||
| new_slot_time.hour,00)) + timedelta(hours=1) | ||
| next_slot = slot_history.filter(start_time__date=new_slot_date, |
There was a problem hiding this comment.
What is difference between prev_hour and next_hour, also next_plot and prev_slot?
There was a problem hiding this comment.
prev_hour is "previous hour" of current hour and next_hour is "next_hour" of current_hour. prev_slot is the query to find any booked slot on prev_hour and next_slot is to find the booked slot for next_hour. Basically There should not be any consecutive booking of slots. There should be at least 1 hour gap between slot booking.
There was a problem hiding this comment.
So have you tested booking after an hour?
Does it work?
B'coz I think as per the code the gap is atleast of 2 hours.
Kindly check.
There was a problem hiding this comment.
I am still not convince with the code, there are many things like,
- form is saved first and then date is validated
- validation can be in forms or a separate function, as the view as become very huge and complex
- date and time in filter is matched by equal to and no less than or greater to...
Would like to see the working before finalizing this.
| f.close() | ||
| except: | ||
| raise Http404("Log does not exist for this profile.") | ||
| messages.error(request,'Log does not exist for this profile.') |
There was a problem hiding this comment.
You can mention the exception class as well.
| new_slot_time.hour,00)) + timedelta(hours=1) | ||
| next_slot = slot_history.filter(start_time__date=new_slot_date, | ||
| start_time__time=next_hour) | ||
| if prev_slot.exists() or next_slot.exists(): |
There was a problem hiding this comment.
Slight not clear how this if works!
Can you please explain.
B'coz
- Will next slot ever exists?
- prev_slot is exact match with the hour!
Also, better would be writing tests, but as this needs to go live ASAP so kindly check this with all the corner cases manually once.
There was a problem hiding this comment.
Next slot exists if you have booked future slot in advance.
- Fix consecutive slot booking issue. - Add Forum and Contact us in SBHSInfocenter dropdown. - Disable Refresh button in show_video for 3 seconds.
| setInterval(function(){ | ||
| var refresh = new Image(); | ||
| refresh.src = "{% static image_link %}"; | ||
| refresh.src = "{% static image_link %}"; |
There was a problem hiding this comment.
A suggestion, the function defined here can be defined outside if tag as the same operation is done in else!
So you can simply use the function defined outside if, wherever needed!
prathamesh920
left a comment
There was a problem hiding this comment.
Please see the replies to the comments