Skip to content

[BUG][HIGH] Self-schedule end date calculation TypeError and logic bug #672

Description

@kambiz-aghaiepour

Description

The self-schedule end date calculation has two bugs:

  1. ssm_deadline_hour is a string from config but passed directly to datetime.replace(hour=...) which requires an integer, causing a TypeError.
  2. Even if cast to int, if the user requests at 22:00 and the deadline hour is 21:00, days_ahead could be 0, making end before start, causing valid requests to be rejected.

Affected Code

# src/quads/server/blueprints/schedules.py:248-262
ssm_deadline_hour = Config.get("ssm_deadline_hour", "21")  # returns string "21"
end = start.replace(hour=ssm_deadline_hour, minute=0, second=0, microsecond=0) + timedelta(days=days_ahead)

Impact

  • TypeError crash when self-scheduling is attempted
  • Valid scheduling requests rejected due to end date before start date

Recommended Fix

  1. Cast ssm_deadline_hour to int: int(Config.get("ssm_deadline_hour", "21"))
  2. Fix the logic to ensure end is always after start, e.g., if computed end < start, advance by one more day.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions