-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add daily-round-robin scheduler algorithm #259
base: master
Are you sure you want to change the base?
Add daily-round-robin scheduler algorithm #259
Conversation
Adds daily-round-robin algorithm for oncall scheduler. This algorithm creates events for a roster in a daily round robin fashion.
@@ -312,7 +312,7 @@ CREATE TABLE IF NOT EXISTS `contact_mode` ( | |||
-- Initialize contact modes | |||
-- ----------------------------------------------------- | |||
INSERT INTO `contact_mode` (`name`) | |||
VALUES ('email'), ('sms'), ('call'), ('slack'), ('teams_messenger'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is teams_messenger being deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its removed as teams_messenger is not a basic mode of contact in oncall.
Else it can be added any time in the contact_mode table to make it accessible in the UI.
@@ -0,0 +1,442 @@ | |||
from datetime import datetime, timedelta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should inherit from either the default or round-robin scheduler. Probably round-robin, as that's what you're trying to do here. Too much copy-paste here.
In addition, I don't think this does round-robin scheduling, since this is copied from the default scheduler (which schedules to maximize time from previous shifts).
@@ -44,15 +45,49 @@ def on_delete(req, resp, team, roster, user): | |||
roster_id = cursor.fetchone() | |||
if roster_id is None: | |||
raise HTTPNotFound() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic can be handled by the scheduler. In particular, the round-robin scheduler uses the calendar to guess the previous user if one has been deleted, so we don't need to do any schedule management in a roster_user action.
@@ -1125,7 +1126,19 @@ <h4> | |||
</div> | |||
</form> | |||
</script> | |||
|
|||
<script> | |||
function scheduler_select(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS functions should live in oncall.js
@@ -1102,9 +1102,10 @@ <h4> | |||
<div class="schedule-algo col-md-3"> | |||
<label class="label-col">Scheduling Algorithms:</label> | |||
<br> | |||
<select name="from" class="form-control schedule-algorithm" id="schedule-algorithm"> | |||
<select onClick="scheduler_select(event)" name="from" class="form-control schedule-algorithm" id="schedule-algorithm"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid inline JS.
Adds a new scheduler that creates schedules in round-robin fashion and produces day long events by assigning every event with a different user.