P2 import is working
Some checks failed
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m18s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m14s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m10s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m11s

This commit is contained in:
2025-12-04 15:53:11 +01:00
parent 0e3b3933f0
commit a3fa8f9b91
2 changed files with 14 additions and 3 deletions

View File

@@ -362,13 +362,24 @@ public class PedrolloPLImportP2 : BaseDataImporter
_logger.LogDebug("{ImporterType}: Saving {RecordCount} records to layer {LayerId}", _logger.LogDebug("{ImporterType}: Saving {RecordCount} records to layer {LayerId}",
ImporterType, records.Count, importLayer.Id); ImporterType, records.Count, importLayer.Id);
// Set LayerId for all records // Delete any existing records for this layer (shouldn't be any, but just in case)
var toDelete = _db.Records.Where(x => x.LayerId == importLayer.Id).ToList();
if (toDelete.Count > 0)
{
_logger.LogWarning("{ImporterType}: Found {ExistingCount} existing records for layer {LayerId}, removing them",
ImporterType, toDelete.Count, importLayer.Id);
_db.Records.RemoveRange(toDelete);
}
// Set all required properties for each record
foreach (var record in records) foreach (var record in records)
{ {
record.LayerId = importLayer.Id; record.LayerId = importLayer.Id;
record.CreatedById = importLayer.CreatedById;
record.ModifiedById = importLayer.ModifiedById;
_db.Records.Add(record);
} }
_db.Records.AddRange(records);
_db.SaveChanges(); _db.SaveChanges();
_logger.LogInformation("{ImporterType}: Successfully saved {RecordCount} records to layer '{LayerName}'", _logger.LogInformation("{ImporterType}: Successfully saved {RecordCount} records to layer '{LayerName}'",

View File

@@ -64,7 +64,7 @@ public partial class LayerDetailPage : ComponentBase
if (layer != null && layer.Records != null) if (layer != null && layer.Records != null)
{ {
records = layer.Records; records = layer.Records.OrderBy(r => r.Code).ToList();
CalculateDisplayedColumns(); CalculateDisplayedColumns();
CalculateValueSum(); CalculateValueSum();
BuildUserCache(); BuildUserCache();