forked from ddrilling/AsbCloudServer
small correction
This commit is contained in:
parent
55e17f6955
commit
9b1b1f9736
@ -71,8 +71,8 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
var groupRecordDate = (recordAllFloat.Union(recordAllInt)).Union(recordAllString)
|
var groupRecordDate = (recordAllFloat.Union(recordAllInt)).Union(recordAllString)
|
||||||
.GroupBy(g => new
|
.GroupBy(g => new
|
||||||
{
|
{
|
||||||
IdRecord = g.IdRecord,
|
g.IdRecord,
|
||||||
Date = g.Date
|
g.Date
|
||||||
}).ToList();
|
}).ToList();
|
||||||
var dtos = groupRecordDate.Select(g => new WitsRecordDto
|
var dtos = groupRecordDate.Select(g => new WitsRecordDto
|
||||||
{
|
{
|
||||||
@ -82,8 +82,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
Items = g.Select(r => new {
|
Items = g.Select(r => new {
|
||||||
Key = r.IdItem,
|
Key = r.IdItem,
|
||||||
Value = r.Item
|
Value = r.Item
|
||||||
}).ToList().ToDictionary(x => x.Key, x => x.Value)
|
}).ToList().ToDictionary(x => x.Key, x => x.Value)
|
||||||
|
|
||||||
});
|
});
|
||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
@ -119,29 +118,28 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
DateTimeOffset dateEnd, bool filterByDateEnd, int approxPointsCount, double timezoneHours
|
DateTimeOffset dateEnd, bool filterByDateEnd, int approxPointsCount, double timezoneHours
|
||||||
, CancellationToken token)
|
, CancellationToken token)
|
||||||
{
|
{
|
||||||
//if (filterByDateEnd)
|
if (filterByDateEnd)
|
||||||
// query = query.Where(d => d.DateTime <= dateEnd);
|
query = query.Where(d => d.DateTime <= dateEnd);
|
||||||
|
|
||||||
//var fullDataCount = await query.CountAsync(token)
|
var fullDataCount = await query.CountAsync(token)
|
||||||
// .ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
//if (fullDataCount == 0)
|
if (fullDataCount == 0)
|
||||||
// return Enumerable.Empty<WitsItemFloat>();
|
return Enumerable.Empty<ItemRecord>();
|
||||||
|
|
||||||
//if (fullDataCount > 1.75 * approxPointsCount)
|
if (fullDataCount > 1.75 * approxPointsCount)
|
||||||
//{
|
{
|
||||||
// var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
||||||
// if (m > 1)
|
if (m > 1)
|
||||||
// query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % m == 0);
|
query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % m == 0);
|
||||||
//}
|
}
|
||||||
|
|
||||||
var entities = await query
|
var entities = await query
|
||||||
.OrderBy(d => d.DateTime)
|
.OrderBy(d => d.DateTime)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
if (entities is null)
|
|
||||||
return Enumerable.Empty<ItemRecord>();
|
|
||||||
var items = entities.Select(e => new ItemRecord
|
var items = entities.Select(e => new ItemRecord
|
||||||
{
|
{
|
||||||
IdRecord = e.IdRecord,
|
IdRecord = e.IdRecord,
|
||||||
|
Loading…
Reference in New Issue
Block a user