Open
Conversation
snajjar
reviewed
Nov 13, 2024
Comment on lines
+43
to
+45
| unique_stops = set() | ||
| for stop in stops: | ||
| unique_stops.add(stop) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.