Исправление бага, при котором метод GetCurrent возвращал лишние значения
All checks were successful
Unit tests / test (push) Successful in 1m14s
All checks were successful
Unit tests / test (push) Successful in 1m14s
This commit is contained in:
parent
5497b89c3b
commit
2a0fa0f3f9
@ -16,14 +16,19 @@ namespace DD.Persistence.Repository.Repositories
|
|||||||
|
|
||||||
protected virtual IQueryable<Setpoint> GetQueryReadOnly() => db.Set<Setpoint>();
|
protected virtual IQueryable<Setpoint> GetQueryReadOnly() => db.Set<Setpoint>();
|
||||||
|
|
||||||
public async Task<IEnumerable<SetpointValueDto>> GetCurrent(IEnumerable<Guid> setpointKeys, CancellationToken token)
|
public async Task<IEnumerable<SetpointValueDto>> GetCurrent(
|
||||||
|
IEnumerable<Guid> setpointKeys,
|
||||||
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = GetQueryReadOnly();
|
var query = GetQueryReadOnly();
|
||||||
|
|
||||||
var entities = await query
|
var entities = await query
|
||||||
.Where(e => setpointKeys.Contains(e.Key))
|
.Where(e => setpointKeys.Contains(e.Key))
|
||||||
|
.GroupBy(e => e.Key)
|
||||||
|
.Select(g => g.OrderByDescending(x => x.Created).FirstOrDefault())
|
||||||
.ToArrayAsync(token);
|
.ToArrayAsync(token);
|
||||||
var dtos = entities.Select(e => e.Adapt<SetpointValueDto>());
|
|
||||||
|
|
||||||
|
var dtos = entities.Select(e => e.Adapt<SetpointValueDto>());
|
||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user