Improve workers for backtests
This commit is contained in:
@@ -75,9 +75,10 @@ public class PostgreSqlGeneticRepository : IGeneticRepository
|
||||
|
||||
public async Task UpdateGeneticRequestAsync(GeneticRequest geneticRequest)
|
||||
{
|
||||
var existingEntity = _context.GeneticRequests
|
||||
var existingEntity = await _context.GeneticRequests
|
||||
.AsTracking() // Explicitly enable tracking to ensure entity is tracked
|
||||
.Include(gr => gr.User)
|
||||
.FirstOrDefault(gr => gr.RequestId == geneticRequest.RequestId);
|
||||
.FirstOrDefaultAsync(gr => gr.RequestId == geneticRequest.RequestId);
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
@@ -110,9 +111,13 @@ public class PostgreSqlGeneticRepository : IGeneticRepository
|
||||
existingEntity.EligibleIndicatorsJson = "[]";
|
||||
}
|
||||
|
||||
// Only update the tracked entity, do not attach a new one
|
||||
// Save changes - entity is tracked so changes will be persisted
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"Genetic request with RequestId '{geneticRequest.RequestId}' not found in database");
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteGeneticRequestByIdForUser(User user, string id)
|
||||
|
||||
Reference in New Issue
Block a user