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 appointment end time calculation for very short services #262

Open
adamspd opened this issue Sep 2, 2024 · 0 comments
Open

Fix appointment end time calculation for very short services #262

adamspd opened this issue Sep 2, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@adamspd
Copy link
Owner

adamspd commented Sep 2, 2024

Currently, when a service has a duration of less than 1 minute, the JavaScript function calculating the end time doesn't account for seconds. This results in the end time being identical to the start time, triggering a validation error in the Django model.

Problem:

  1. Service duration is set to less than 1 minute (e.g., 30 seconds)
  2. JavaScript rounds down to 0 minutes when calculating end time
  3. Start time and end time are the same
  4. Django model validation fails, preventing appointment creation

Proposed solutions:

  1. Update JavaScript to handle seconds in duration calculation

    • Pros: More precise, allows for very short services
    • Cons: Requires changes to frontend logic and possibly UI
  2. Set a minimum service duration of 1 minute

    • Pros: Simple to implement, prevents edge case entirely
    • Cons: Limits flexibility for very short services

Next steps:

  • Decide on preferred solution
  • Implement chosen solution
  • Update tests to cover this edge case
  • Update documentation if minimum duration is enforced

This issue affects the usability of the system for very short services and should be addressed to ensure proper functionality across all service durations.

But seriously, I'd love to hear from someone who has a service duration of less than a minute...use case etc.

This issue is open to anyone who wants to implement it.

@adamspd adamspd added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant