Changed Seeding for Units to be fewer per customer and cleanup needless allocation within unit generation

This commit is contained in:
2021-10-19 20:00:57 +00:00
parent dee6f80894
commit 52428ef5cf

View File

@@ -1878,12 +1878,14 @@ namespace AyaNova.Util
switch (slevel)
{
case Level.SeedLevel.Small:
await SeedUnitAsync(log, 2, NewObject.Id);
break;
case Level.SeedLevel.Large:
case Level.SeedLevel.Medium:
await SeedUnitAsync(log, 20, NewObject.Id);
await SeedUnitAsync(log, 5, NewObject.Id);
break;
case Level.SeedLevel.Huge:
await SeedUnitAsync(log, 100, NewObject.Id);
await SeedUnitAsync(log, 10, NewObject.Id);
break;
}
}
@@ -2213,6 +2215,8 @@ namespace AyaNova.Util
public HashSet<string> HashUnitNames = new HashSet<string>();
//private int TotalSeededUnits = 0;
private Dictionary<long, List<long>> CustomerUnits = new Dictionary<long, List<long>>();
public int[] WarrantyMonths = new[] { 1, 6, 12, 24, 36 };
public string[] WarrantyTerms = new[] { "Parts only", "Parts and service", "Service only", "Shipping parts and service", "First month parts and service here; after is depot only" };
//////////////////////////////////////////////////////
//UNIT
@@ -2221,8 +2225,6 @@ namespace AyaNova.Util
{
DateTime seedStartWindow = DateTime.Now.AddYears(-10);
DateTime seedEndWindow = DateTime.Now.AddYears(1);
var WarrantyMonths = new[] { 1, 6, 12, 24, 36 };
var WarrantyTerms = new[] { "Parts only", "Parts and service", "Service only", "Shipping parts and service", "First month parts and service here; after is depot only" };
List<long> unitsAddedThisRun = new List<long>();
for (int x = 0; x < count; x++)
{
@@ -2846,7 +2848,7 @@ namespace AyaNova.Util
o.InternalReferenceNumber = "irf-" + Fake.Finance.Account(4);
o.ServiceDate = woDate;
var actualWorkorderItemCount=Fake.Random.Int(1,MaximumWorkOrderItemCount);
var actualWorkorderItemCount = Fake.Random.Int(1, MaximumWorkOrderItemCount);
for (int y = 0; y < actualWorkorderItemCount; y++)
{
var woItem = new WorkOrderItem()
@@ -2871,7 +2873,7 @@ namespace AyaNova.Util
}
//SCHEDULED USERS
var actualScheduledUserCount=Fake.Random.Int(1,2);
var actualScheduledUserCount = Fake.Random.Int(1, 2);
for (int a = 0; a < actualScheduledUserCount; a++)
{
var randomStart = Fake.Random.Int(0, 5);