Skip to content

Commit

Permalink
Released v5.0.5
Browse files Browse the repository at this point in the history
# Changelog for MEM.Zone-Dashboards

## 5.0.5 - 2024-02-02

* Fixed variable bug `Next Maintenance Window` if using `Offset Days` maintenance windows (issue #31).
  • Loading branch information
Ioan-Popovici committed Feb 2, 2024
1 parent 04a822e commit fa12e93
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ AS
-- Calculate the next interval
DECLARE @WeeklyNextInterval DATETIME; SET @WeeklyNextInterval = DATEADD(WEEK, @WeeklyNumberOfCompletedIntervals * @WeeklyInterval, @WeeklyStartTime)

-- Recalc the next interval if the next interval plus the expected duration is in the past
-- Recalculate the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @WeeklyNextInterval) < @Now BEGIN
SET @WeeklyNextInterval = DATEADD(WEEK, (@WeeklyNumberOfCompletedIntervals + 1) * @WeeklyInterval, @WeeklyStartTime)
END

SET @NextMaintenanceWindow = @WeeklyNextInterval
END
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAY OR @RecurrenceType = RecurrenceType_MONTHLYBYWEEKDAYBASE BEGIN
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAY OR @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAYBASE BEGIN
DECLARE @MonthlyBWWeek INT; SET @MonthlyBWWeek = (@ScheduleDuration / POWER(2,9)) % POWER(2, 3)
DECLARE @MontlhyBWInterval INT; SET @MontlhyBWInterval = (@ScheduleDuration / POWER(2,12)) % POWER(2, 4)
DECLARE @MonthlyBWDoW INT; SET @MonthlyBWDoW = (@ScheduleDuration / POWER(2,16)) % POWER(2, 3)
Expand All @@ -194,7 +194,7 @@ AS
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, -(7 - DATEPART(WEEKDAY, @MonthlyBWLDOMNextInterval) + @MonthlyBWDoW % 7), @MonthlyBWLDOMNextInterval)

IF DATEADD(MINUTE, @Duration, @MonthlyBWLDOMNextInterval) < @Now BEGIN
-- Recalc for the next month interval
-- Recalculate for the next month interval
SET @MonthlyBWLDOMNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)

-- Calculate last day of month
Expand All @@ -219,7 +219,7 @@ AS
SET @MonthlyBWNextInterval = DATEADD(WEEK, @MonthlyBWWeek-1, @MonthlyBWNextInterval)

IF DATEADD(MINUTE, @Duration, @MonthlyBWNextInterval) < @Now BEGIN
-- Recalc for the next month interval
-- Recalculate for the next month interval
SET @MonthlyBWNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)

-- Set the date to the first day of the month
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for MEM.Zone-Dashboards

## 5.0.5 - 2024-02-02

* Fixed variable bug `Next Maintenance Window` if using `Offset Days` maintenance windows (issue #31).

## 5.0.4 - 2024-01-30

* Fixed `Next Maintenance Window` if using `Offset Days` maintenance windows #31.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ AS
-- Calculate the next interval
DECLARE @WeeklyNextInterval DATETIME; SET @WeeklyNextInterval = DATEADD(WEEK, @WeeklyNumberOfCompletedIntervals * @WeeklyInterval, @WeeklyStartTime)

-- Recalc the next interval if the next interval plus the expected duration is in the past
-- Recalculate the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @WeeklyNextInterval) < @Now BEGIN
SET @WeeklyNextInterval = DATEADD(WEEK, (@WeeklyNumberOfCompletedIntervals + 1) * @WeeklyInterval, @WeeklyStartTime)
END

SET @NextMaintenanceWindow = @WeeklyNextInterval
END
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAY OR @RecurrenceType = RecurrenceType_MONTHLYBYWEEKDAYBASE BEGIN
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAY OR @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAYBASE BEGIN
DECLARE @MonthlyBWWeek INT; SET @MonthlyBWWeek = (@ScheduleDuration / POWER(2,9)) % POWER(2, 3)
DECLARE @MontlhyBWInterval INT; SET @MontlhyBWInterval = (@ScheduleDuration / POWER(2,12)) % POWER(2, 4)
DECLARE @MonthlyBWDoW INT; SET @MonthlyBWDoW = (@ScheduleDuration / POWER(2,16)) % POWER(2, 3)
Expand All @@ -194,7 +194,7 @@ AS
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, -(7 - DATEPART(WEEKDAY, @MonthlyBWLDOMNextInterval) + @MonthlyBWDoW % 7), @MonthlyBWLDOMNextInterval)

IF DATEADD(MINUTE, @Duration, @MonthlyBWLDOMNextInterval) < @Now BEGIN
-- Recalc for the next month interval
-- Recalculate for the next month interval
SET @MonthlyBWLDOMNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)

-- Calculate last day of month
Expand All @@ -219,7 +219,7 @@ AS
SET @MonthlyBWNextInterval = DATEADD(WEEK, @MonthlyBWWeek-1, @MonthlyBWNextInterval)

IF DATEADD(MINUTE, @Duration, @MonthlyBWNextInterval) < @Now BEGIN
-- Recalc for the next month interval
-- Recalculate for the next month interval
SET @MonthlyBWNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)

-- Set the date to the first day of the month
Expand Down
4 changes: 4 additions & 0 deletions src/MEM.Zone-Dashboards/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for MEM.Zone-Dashboards

## 5.0.5 - 2024-02-02

* Fixed variable bug `Next Maintenance Window` if using `Offset Days` maintenance windows (issue #31).

## 5.0.4 - 2024-01-30

* Fixed `Next Maintenance Window` if using `Offset Days` maintenance windows #31.
Expand Down

0 comments on commit fa12e93

Please sign in to comment.