proposition for new timing tags *minute and *hour to be used in action

plans on recurring charges.
NOTE: minute interval executes every second minute but logs from the
scheduler report execution every minute
This commit is contained in:
John Koce Steel
2017-05-29 10:22:31 +02:00
parent f19fccdd1f
commit 06c01cbce0
4 changed files with 45 additions and 1 deletions

View File

@@ -108,6 +108,8 @@ const (
UNLIMITED = "*unlimited"
ZERO = "*zero"
ASAP = "*asap"
MINUTE = "*minute"
HOUR = "*hour"
USERS = "*users"
COMMENT_CHAR = '#'
CSV_SEP = ','

View File

@@ -102,5 +102,21 @@ func incrementalFormula(params map[string]interface{}) float64 {
return units / DaysInYear(now.Year())
}
}
if increment == "hour" {
if interval == "day" {
return units / 24
}
if interval == "month" {
return units / ( DaysInMonth(now.Year(), now.Month()) * 24 )
}
if interval == "year" {
return units / ( DaysInYear(now.Year()) * 24 )
}
}
if increment == "minute" {
if interval == "hour" {
return units / 60
}
}
return 0.0
}