规则:
问题:如果在周五或周六应用修复,如何延迟在工作日发送通知?
我的尝试:
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?
}
}
}
答案 0 :(得分:0)
我看到的最直接的方式是添加几个'N小时'规则,这将适用于当天的不同变体(例如,在46小时内,如果今天是'星期二'(即问题)在周日被移到这个状态),发送通知等)。
另一种方法是避免使用状态机并切换到预定规则,这将检查状态和一些日期字段(当状态变为Requested时设置为'now')每小时一次并在需要时发送通知