Skip to content

GaspardFouche Padam Test PR#52

Open
gaspF wants to merge 7 commits intoOptiways:masterfrom
gaspF:dev
Open

GaspardFouche Padam Test PR#52
gaspF wants to merge 7 commits intoOptiways:masterfrom
gaspF:dev

Conversation

@gaspF
Copy link

@gaspF gaspF commented Nov 4, 2024

This pull request adds new models and associated functionality as part of the technical test for Padam Mobility.

Summary of Changes:
Models:
BusStop: Represents a bus stop, including fields for the stop’s name, location (place), and scheduled time (stop_time). A unique constraint is enforced on the combination of name, place, and stop_time.

BusShift: Defines a shift for a bus and driver, including fields for the associated bus, driver, and multiple stops. It also calculates start_time, end_time, and duration for the shift based on the assigned stops.

Form Validation:
BusShiftForm: Implements custom validation to ensure each shift includes at least two unique stops and calculates the shift’s start and end times based on these stops. Additionally, it checks for overlapping shifts to avoid conflicts for the same bus or driver.

Tests:
Added test cases to validate the functionality of BusStop and BusShift models, including constraints, validation rules, and shift duration calculations.

Comment on lines +43 to +45
unique_stops = set()
for stop in stops:
unique_stops.add(stop)
Copy link

Choose a reason for hiding this comment

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

unique_stops = set(stops.values())

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