This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -363,6 +363,10 @@ namespace AyaNova.Util
|
|||||||
await EraseTableAsync("areminder", conn);//depends on User
|
await EraseTableAsync("areminder", conn);//depends on User
|
||||||
await EraseTableAsync("areview", conn);//depends on User
|
await EraseTableAsync("areview", conn);//depends on User
|
||||||
|
|
||||||
|
//RATES --- lots of dependants
|
||||||
|
await EraseTableAsync("aservicerate", conn);
|
||||||
|
await EraseTableAsync("atravelrate", conn);
|
||||||
|
|
||||||
|
|
||||||
//Delete from user options table first
|
//Delete from user options table first
|
||||||
using (var cmd = new Npgsql.NpgsqlCommand())
|
using (var cmd = new Npgsql.NpgsqlCommand())
|
||||||
|
|||||||
@@ -238,6 +238,10 @@ namespace AyaNova.Util
|
|||||||
//PROJECTS
|
//PROJECTS
|
||||||
await SeedProjectAsync(log, 25);
|
await SeedProjectAsync(log, 25);
|
||||||
|
|
||||||
|
//RATES
|
||||||
|
await SeedServiceRateAsync(log, 5);
|
||||||
|
await SeedTravelRateAsync(log, 2);
|
||||||
|
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -303,6 +307,10 @@ namespace AyaNova.Util
|
|||||||
//PROJECTS
|
//PROJECTS
|
||||||
await SeedProjectAsync(log, 50);
|
await SeedProjectAsync(log, 50);
|
||||||
|
|
||||||
|
//RATES
|
||||||
|
await SeedServiceRateAsync(log, 10);
|
||||||
|
await SeedTravelRateAsync(log, 4);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"MEDIUM level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"MEDIUM level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -383,6 +391,10 @@ namespace AyaNova.Util
|
|||||||
//PROJECTS
|
//PROJECTS
|
||||||
await SeedProjectAsync(log, 75);
|
await SeedProjectAsync(log, 75);
|
||||||
|
|
||||||
|
//RATES
|
||||||
|
await SeedServiceRateAsync(log, 20);
|
||||||
|
await SeedTravelRateAsync(log, 10);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"LARGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"LARGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -445,9 +457,6 @@ namespace AyaNova.Util
|
|||||||
//accountant / bookkeeper
|
//accountant / bookkeeper
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//WIDGETS
|
//WIDGETS
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
@@ -463,6 +472,10 @@ namespace AyaNova.Util
|
|||||||
//PROJECTS
|
//PROJECTS
|
||||||
await SeedProjectAsync(log, 500);
|
await SeedProjectAsync(log, 500);
|
||||||
|
|
||||||
|
//RATES
|
||||||
|
await SeedServiceRateAsync(log, 30);
|
||||||
|
await SeedTravelRateAsync(log, 15);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"HUGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"HUGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -536,6 +549,7 @@ namespace AyaNova.Util
|
|||||||
public HashSet<string> HashUserNames = new HashSet<string>();
|
public HashSet<string> HashUserNames = new HashSet<string>();
|
||||||
public HashSet<string> HashCompanyNames = new HashSet<string>();
|
public HashSet<string> HashCompanyNames = new HashSet<string>();
|
||||||
public HashSet<string> HashProjectNames = new HashSet<string>();
|
public HashSet<string> HashProjectNames = new HashSet<string>();
|
||||||
|
public HashSet<string> HashRateNames = new HashSet<string>();
|
||||||
|
|
||||||
|
|
||||||
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
||||||
@@ -1138,6 +1152,86 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//SERVICERATE
|
||||||
|
//
|
||||||
|
public async Task SeedServiceRateAsync(ILogger log, int count)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
ServiceRate o = new ServiceRate();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var color = Fake.Commerce.Color();
|
||||||
|
o.Name = $"{char.ToUpper(color[0]) + color.Substring(1)} {Fake.Lorem.Word()}";
|
||||||
|
} while (!HashRateNames.Add(o.Name));
|
||||||
|
o.AccountNumber = Fake.Finance.Account();
|
||||||
|
o.Active = true;
|
||||||
|
o.Notes = Fake.Lorem.Sentence();
|
||||||
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
|
o.Cost = Fake.Random.Decimal(0.25m, 50);
|
||||||
|
o.Charge = o.Cost * 1.55m;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(o);
|
||||||
|
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedServiceRate error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//SERVICERATE
|
||||||
|
//
|
||||||
|
public async Task SeedTravelRateAsync(ILogger log, int count)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
TravelRate o = new TravelRate();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var color = Fake.Commerce.Color();
|
||||||
|
o.Name = $"{char.ToUpper(color[0]) + color.Substring(1)} {Fake.Lorem.Word()}";
|
||||||
|
} while (!HashRateNames.Add(o.Name));
|
||||||
|
o.AccountNumber = Fake.Finance.Account();
|
||||||
|
o.Active = true;
|
||||||
|
o.Notes = Fake.Lorem.Sentence();
|
||||||
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
|
o.Cost = Fake.Random.Decimal(0.25m, 50);
|
||||||
|
o.Charge = o.Cost * 1.55m;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
TravelRateBiz biz = TravelRateBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(o);
|
||||||
|
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedTravelRate error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user