Skip to content

Commit

Permalink
feat: change DAYS config to exclusion list
Browse files Browse the repository at this point in the history
  • Loading branch information
miiila committed Jun 5, 2017
1 parent 64e2bd1 commit 8a88ba4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pagerduty.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ processSchedulesFromConfig = (done) ->
, (err, results) ->
if err then cb err
if results
processSchedules results, processedConfig['DAYS'], (err, message) ->
processSchedules results, processedConfig['EXCLUSION_DAYS'], (err, message) ->
messages = messages.concat(message)
debug('processSchedules:', processedConfig)
if processedConfig['NOTIFICATIONS'] && message isnt "OK"
Expand Down Expand Up @@ -126,7 +126,7 @@ processSchedules = (allSchedules, days = [], cb) ->
day = new Date(myStart).getUTCDay()
if myStart <= crossCheckEntry.start < myEnd and
crossCheckEntry.user.id == myUserId and
(day in days or !days.length)
(day not in days or !days.length)
message = """Overlapping duty found for user #{myUserName}
from #{myStart} to #{myEnd} on schedule ID #{schedule.id}!"""
messages.push message
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/config-days.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"PAGERDUTY_TOKEN" : "111111111111"
},
"DAYS": [0, 1, 2, 3, 4]
"EXCLUSION_DAYS": [5, 6]
}]
}

0 comments on commit 8a88ba4

Please sign in to comment.