Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brownhash
Copy link
Contributor

Adds a new scheduler that creates schedules in round-robin fashion and produces day long events by assigning every event with a different user.

Harshit Sharma added 2 commits June 20, 2019 17:19
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');
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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()

Copy link
Contributor

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)
Copy link
Contributor

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">
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid inline JS.

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.

3 participants