Changed Seeding for Units to be fewer per customer and cleanup needless allocation within unit generation
This commit is contained in:
@@ -229,7 +229,7 @@ namespace AyaNova.Util
|
|||||||
//Generate one office person / secretary
|
//Generate one office person / secretary
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.Accounting, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.Accounting, UserType.NotService);
|
||||||
|
|
||||||
//2 other techs (must always be enough to have no dupes per workorder)
|
//2 other techs (must always be enough to have no dupes per workorder)
|
||||||
await SeedUserAsync(log, 2, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
await SeedUserAsync(log, 2, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
||||||
|
|
||||||
await SeedVendorAsync(log, 10);
|
await SeedVendorAsync(log, 10);
|
||||||
@@ -273,18 +273,18 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdmin | AuthorizationRoles.OpsAdminRestricted, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdmin | AuthorizationRoles.OpsAdminRestricted, UserType.NotService);
|
||||||
//One owner who doesn't control anything but views stuff
|
//One owner who doesn't control anything but views stuff
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted | AuthorizationRoles.SalesRestricted, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted | AuthorizationRoles.SalesRestricted, UserType.NotService);
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
//TECHS (LICENSE CONSUMERS)
|
//TECHS (LICENSE CONSUMERS)
|
||||||
//trial license allows 1000
|
//trial license allows 1000
|
||||||
//
|
//
|
||||||
//regular techs
|
//regular techs
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
await SeedUserAsync(log, 5, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
||||||
//Restricted techs
|
//Restricted techs
|
||||||
// await SeedUserAsync(log, 2, AuthorizationRoles.TechRestricted | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
// await SeedUserAsync(log, 2, AuthorizationRoles.TechRestricted | AuthorizationRoles.ServiceRestricted, UserType.Service);
|
||||||
//subcontractors
|
//subcontractors
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractor, UserType.ServiceContractor);
|
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractor, UserType.ServiceContractor);
|
||||||
//Restricted subcontractors
|
//Restricted subcontractors
|
||||||
// await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor);
|
// await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor);
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
//3 generic office people people
|
//3 generic office people people
|
||||||
await SeedUserAsync(log, 3, AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted, UserType.NotService);
|
await SeedUserAsync(log, 3, AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted, UserType.NotService);
|
||||||
@@ -343,7 +343,7 @@ namespace AyaNova.Util
|
|||||||
//owner / upper management who doesn't control anything but views stuff
|
//owner / upper management who doesn't control anything but views stuff
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted, UserType.NotService);
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
//TECHS (LICENSE CONSUMERS)
|
//TECHS (LICENSE CONSUMERS)
|
||||||
//trial license allows 1000
|
//trial license allows 1000
|
||||||
//
|
//
|
||||||
@@ -1878,12 +1878,14 @@ namespace AyaNova.Util
|
|||||||
switch (slevel)
|
switch (slevel)
|
||||||
{
|
{
|
||||||
case Level.SeedLevel.Small:
|
case Level.SeedLevel.Small:
|
||||||
|
await SeedUnitAsync(log, 2, NewObject.Id);
|
||||||
|
break;
|
||||||
case Level.SeedLevel.Large:
|
case Level.SeedLevel.Large:
|
||||||
case Level.SeedLevel.Medium:
|
case Level.SeedLevel.Medium:
|
||||||
await SeedUnitAsync(log, 20, NewObject.Id);
|
await SeedUnitAsync(log, 5, NewObject.Id);
|
||||||
break;
|
break;
|
||||||
case Level.SeedLevel.Huge:
|
case Level.SeedLevel.Huge:
|
||||||
await SeedUnitAsync(log, 100, NewObject.Id);
|
await SeedUnitAsync(log, 10, NewObject.Id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2213,6 +2215,8 @@ namespace AyaNova.Util
|
|||||||
public HashSet<string> HashUnitNames = new HashSet<string>();
|
public HashSet<string> HashUnitNames = new HashSet<string>();
|
||||||
//private int TotalSeededUnits = 0;
|
//private int TotalSeededUnits = 0;
|
||||||
private Dictionary<long, List<long>> CustomerUnits = new Dictionary<long, List<long>>();
|
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
|
//UNIT
|
||||||
@@ -2221,8 +2225,6 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
DateTime seedStartWindow = DateTime.Now.AddYears(-10);
|
DateTime seedStartWindow = DateTime.Now.AddYears(-10);
|
||||||
DateTime seedEndWindow = DateTime.Now.AddYears(1);
|
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>();
|
List<long> unitsAddedThisRun = new List<long>();
|
||||||
for (int x = 0; x < count; x++)
|
for (int x = 0; x < count; x++)
|
||||||
{
|
{
|
||||||
@@ -2846,7 +2848,7 @@ namespace AyaNova.Util
|
|||||||
o.InternalReferenceNumber = "irf-" + Fake.Finance.Account(4);
|
o.InternalReferenceNumber = "irf-" + Fake.Finance.Account(4);
|
||||||
o.ServiceDate = woDate;
|
o.ServiceDate = woDate;
|
||||||
|
|
||||||
var actualWorkorderItemCount=Fake.Random.Int(1,MaximumWorkOrderItemCount);
|
var actualWorkorderItemCount = Fake.Random.Int(1, MaximumWorkOrderItemCount);
|
||||||
for (int y = 0; y < actualWorkorderItemCount; y++)
|
for (int y = 0; y < actualWorkorderItemCount; y++)
|
||||||
{
|
{
|
||||||
var woItem = new WorkOrderItem()
|
var woItem = new WorkOrderItem()
|
||||||
@@ -2871,12 +2873,12 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
//SCHEDULED USERS
|
//SCHEDULED USERS
|
||||||
var actualScheduledUserCount=Fake.Random.Int(1,2);
|
var actualScheduledUserCount = Fake.Random.Int(1, 2);
|
||||||
for (int a = 0; a < actualScheduledUserCount; a++)
|
for (int a = 0; a < actualScheduledUserCount; a++)
|
||||||
{
|
{
|
||||||
var randomStart = Fake.Random.Int(0, 5);
|
var randomStart = Fake.Random.Int(0, 5);
|
||||||
var randomHours = Fake.Random.Int(1, 4);
|
var randomHours = Fake.Random.Int(1, 4);
|
||||||
// var randomDays = Fake.Random.Int(0, 3);
|
// var randomDays = Fake.Random.Int(0, 3);
|
||||||
var randomStop = randomStart + randomHours;
|
var randomStop = randomStart + randomHours;
|
||||||
var woItemScheduledUser = new WorkOrderItemScheduledUser()
|
var woItemScheduledUser = new WorkOrderItemScheduledUser()
|
||||||
{
|
{
|
||||||
@@ -3262,7 +3264,7 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//All wo ending status
|
//All wo ending status
|
||||||
//if it's in the past tag it with a completed type status
|
//if it's in the past tag it with a completed type status
|
||||||
if (isPast)
|
if (isPast)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user