Skip to content
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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

CruiseDevice
Copy link
Member

  • Fix consecutive slot booking issue.
  • Add Forum and Contact us in SBHSInfocenter dropdown.
  • Disable Refresh button in show_video for 3 seconds.

sbhs/models.py Outdated Show resolved Hide resolved
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,

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?

Copy link
Member Author

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.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it works.

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,

  1. form is saved first and then date is validated
  2. validation can be in forms or a separate function, as the view as become very huge and complex
  3. 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.')

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.

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():

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

  1. Will next slot ever exists?
  2. 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.

Copy link
Member Author

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 %}";

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!

Copy link

@prathamesh920 prathamesh920 left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants