Skip to content

Commit 8a493ac

Browse files
using fields instead of hardcoding start/stop variables
1 parent 2c37f41 commit 8a493ac

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Show Resource Utilization_1/Show Resource Utilization_1.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ namespace Show_Resource_Utilization_1
6969
public class Script
7070
{
7171
private static int durationInDays = 7;
72-
DateTime start;
73-
DateTime end;
72+
private DateTime start;
73+
private DateTime end;
7474

7575
/// <summary>
7676
/// The Script entry point.
@@ -132,8 +132,7 @@ private List<ReservationInstance> GetReservationsByResources(ResourceManagerHelp
132132
{
133133
var resourceFilter = new ORFilterElement<ReservationInstance>(resourceIds.Select(id => ReservationInstanceExposers.ResourceIDsInReservationInstance.Contains(id)).ToArray());
134134

135-
var now = DateTime.UtcNow;
136-
var timeRangeUtc = new TimeRangeUtc(now.AddDays(-7), now);
135+
var timeRangeUtc = new TimeRangeUtc(start, end);
137136

138137
var filter = resourceFilter
139138
.AND(ReservationInstanceExposers.Start.LessThanOrEqual(timeRangeUtc.Stop)
@@ -203,7 +202,7 @@ private void ReturnResultMessage(Engine engine, List<ResourceInfo> resources, bo
203202
},
204203
};
205204

206-
Double maxDuration = 24 * 60 * 7;
205+
Double maxDuration = 24 * 60 * durationInDays;
207206

208207
foreach (var resourceInfo in resources)
209208
{

0 commit comments

Comments
 (0)