TimeToNextShift

Retrieves the time left until the next shift begins.

python · Shift Management

Details

IDTimeToNextShift
Languagepython
From Version5.5.0
Docker Imagedemisto/python3:3.12.13.10116658
TagsShift Management widget

README

Retrieves the time left until the next shift begins.

Script Data


Name Description
Script Type python3
Tags Shift Management, widget
Cortex XSOAR Version 5.5.0

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import time

from freezegun import freeze_time
from TimeToNextShift import get_time_to_next_shift

# set shift on Saturday from 10:00 to 22:00
ROLES = [{"shifts": [{"fromDay": 6, "fromHour": 10, "fromMinute": 0, "toDay": 6, "toHour": 22, "toMinute": 0}]}]


# set time to Saturday, December 12, 2020 12:12:12 PM
@freeze_time(time.ctime(1607775132))
def test_get_time_to_next_shift():
    res = get_time_to_next_shift(ROLES)
    assert res == 35268