YouTrack 中的状态机工作流 - 在状态更改后 22 小时通知记者,仅在工作日

State-machine workflow in YouTrack - notify reporter 22 hours after state change, only on weekdays

规则:

问题:如果在周五或周六应用修复程序,我如何延迟在工作日发送通知?

我的尝试:

state machine Request feedback from reporter for field Feedback {

    initial state Not needed {
        exit {
            // just a placeholder b/c initial state seems to be mandatory
            message ("You are requesting feedback from the reporter.")
        }
    }

    state Requested {
        in 22 hours[always] do {
            // calculate if this is a weekday
            var dayOfWeek = now.format(#EEEE);
            if ( dayOfWeek != "Sat" || dayOfWeek != "Sun" ) {
                reporter.notify("Two hours left to approve fix for the issue"+ getId( ), "Please review the applied fix for issue and set the Feedback to 'Confirmed' or 'Rejected'.");
            } else {
                // somehow delay the notification?
            }         
        }
}

我在这里看到的最直接的方法是添加几个 'in N hours' 规则,这些规则将应用于当天的不同变体(例如,在 46 小时内,如果今天是 'Tue' (即问题在周日移至此状态)、发送通知等)。

另一种方法是避免使用状态机并切换到计划规则,它将每小时检查一次状态和一些日期字段(当状态更改为 Requested 时设置为 'now')并且如果需要发送通知。