Skip to content

Fix appointment end time calculation for very short services #262

@adamspd

Description

@adamspd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions