This commit is contained in:
@@ -136,7 +136,7 @@ namespace AyaNova.Biz
|
||||
foreach (FileInfo file in di.EnumerateFiles())
|
||||
{
|
||||
if (file.Extension.ToLowerInvariant() == ".ayrt")
|
||||
await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)));
|
||||
await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//IMPORT
|
||||
//
|
||||
internal async Task<bool> ImportAsync(JObject o)
|
||||
internal async Task<bool> ImportAsync(JObject o, bool skipIfAlreadyPresent = false)
|
||||
{
|
||||
|
||||
//Report newObject = new Report();
|
||||
@@ -78,7 +78,16 @@ namespace AyaNova.Biz
|
||||
{
|
||||
NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName);
|
||||
if (NotUnique)
|
||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(proposedName, l++, 255);
|
||||
{
|
||||
if (!skipIfAlreadyPresent)
|
||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(proposedName, l++, 255);
|
||||
else
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ReportBiz>();
|
||||
log.LogInformation($"Import report '{proposedName}' skipped due to already present in database.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} while (NotUnique);
|
||||
|
||||
@@ -186,7 +195,7 @@ namespace AyaNova.Biz
|
||||
//GET LIST
|
||||
//
|
||||
internal async Task<List<NameIdItem>> GetReportListAsync(AyaType aType)
|
||||
{
|
||||
{
|
||||
var rpts = await ct.Report.AsNoTracking().Where(z => z.AType == aType && z.Active == true).Select(z => new { id = z.Id, name = z.Name, roles = z.Roles }).OrderBy(z => z.name).ToListAsync();
|
||||
var ret = new List<NameIdItem>();
|
||||
foreach (var item in rpts)
|
||||
|
||||
@@ -568,6 +568,9 @@ namespace AyaNova.Util
|
||||
//If we got here then it's safe to erase the attachment files
|
||||
FileUtil.EraseEntireContentsOfAttachmentFilesFolder();
|
||||
|
||||
_log.LogInformation("Importing any missing stock Report templates");
|
||||
await AyaNova.Biz.PrimeData.PrimeReportTemplates();
|
||||
|
||||
apiServerState.ResumePriorState();
|
||||
|
||||
_log.LogInformation("Database erase completed");
|
||||
|
||||
Reference in New Issue
Block a user