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)
|
||||
.GroupBy(g => new
|
||||
{
|
||||
IdRecord = g.IdRecord,
|
||||
Date = g.Date
|
||||
g.IdRecord,
|
||||
g.Date
|
||||
}).ToList();
|
||||
var dtos = groupRecordDate.Select(g => new WitsRecordDto
|
||||
{
|
||||
@ -83,7 +83,6 @@ namespace AsbCloudInfrastructure.Repository
|
||||
Key = r.IdItem,
|
||||
Value = r.Item
|
||||
}).ToList().ToDictionary(x => x.Key, x => x.Value)
|
||||
|
||||
});
|
||||
return dtos;
|
||||
}
|
||||
@ -119,29 +118,28 @@ namespace AsbCloudInfrastructure.Repository
|
||||
DateTimeOffset dateEnd, bool filterByDateEnd, int approxPointsCount, double timezoneHours
|
||||
, CancellationToken token)
|
||||
{
|
||||
//if (filterByDateEnd)
|
||||
// query = query.Where(d => d.DateTime <= dateEnd);
|
||||
if (filterByDateEnd)
|
||||
query = query.Where(d => d.DateTime <= dateEnd);
|
||||
|
||||
//var fullDataCount = await query.CountAsync(token)
|
||||
// .ConfigureAwait(false);
|
||||
var fullDataCount = await query.CountAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
//if (fullDataCount == 0)
|
||||
// return Enumerable.Empty<WitsItemFloat>();
|
||||
if (fullDataCount == 0)
|
||||
return Enumerable.Empty<ItemRecord>();
|
||||
|
||||
//if (fullDataCount > 1.75 * approxPointsCount)
|
||||
//{
|
||||
// var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
||||
// if (m > 1)
|
||||
// query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % m == 0);
|
||||
//}
|
||||
if (fullDataCount > 1.75 * approxPointsCount)
|
||||
{
|
||||
var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
||||
if (m > 1)
|
||||
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
|
||||
.OrderBy(d => d.DateTime)
|
||||
.AsNoTracking()
|
||||
.ToListAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
if (entities is null)
|
||||
return Enumerable.Empty<ItemRecord>();
|
||||
|
||||
var items = entities.Select(e => new ItemRecord
|
||||
{
|
||||
IdRecord = e.IdRecord,
|
||||
|
Loading…
Reference in New Issue
Block a user