-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix consecutive slot booking issue, and UI issues #11
base: dev
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is difference between prev_hour and next_hour, also next_plot and prev_slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -660,7 +685,8 @@ def profile(request, mid): | |||
f = open(filename, "r") | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mention the exception class as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve this
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
{% if request.user.profile.is_moderator %} | ||
setInterval(function(){ | ||
var refresh = new Image(); | ||
refresh.src = "{% static image_link %}"; | ||
refresh.src = "{% static image_link %}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the replies to the comments