-
Ruby version - 2.3.3
-
Ruby version - 4.2.6
-
System Dependencies
-
bundle install (to install all the Gems and dependencies)
-
rake db:migrate (to install migrations)
-
rails server (to run the rails app)
-
-
Database
-
SQLite
-
-
To run the test suite
-
rake test (To run all the test cases)
-
-
Assumptions made in the algorithm
-
Event will have start and end date in the same day
-
Multiple opening entries is possible in a day E.g [9 - 10:30], [12 - 3:30]
-
Appointment is created only on available slots
-
Each slot is of a 30 min duration
-
-
TASK
-
Write an algorithm that checks the availabilities and return the next 7 days available slots of a doctor.
-
Input is a date
-
Output 7 days available slots
-
They are two kinds of events:
-
‘opening’, are the openings for a specific day and they can be reccuring week by week.
-
‘appointment’, times when the doctor is already booked.
-
-
Sample Event Model
-
rails g model event starts_at:datetime ends_at:datetime kind:string weekly_recurring:boolean
-
-
amalkumars / events Goto Github PK
View Code? Open in Web Editor NEWWrite an algorithm that checks the availabilities and return the next 7 days available slots of a doctor.