uncomment

This commit is contained in:
eugeniy_ivanov 2023-04-17 20:59:27 +05:00
parent f81f092c64
commit 8b9dee1609
2 changed files with 20 additions and 20 deletions

View File

@ -116,21 +116,21 @@ namespace AsbCloudInfrastructure.Repository
, CancellationToken token)
where T: notnull
{
//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<ItemRecord>();
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
.Where(d => d.DateTime >= dateBeginUtc)

View File

@ -46,20 +46,20 @@ namespace AsbCloudWebApi.Controllers.SAUB
/// <param name = "token" > Токен завершения задачи</param>
/// <returns></returns>
[HttpGet("{idWell}")]
// [Permission]
[Permission]
public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync(int idWell, DateTime begin = default,
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
{
//int? idCompany = User.GetCompanyId();
int? idCompany = User.GetCompanyId();
//if (idCompany is null)
// return Forbid();
if (idCompany is null)
return Forbid();
//bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
// idWell, token).ConfigureAwait(false);
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
idWell, token).ConfigureAwait(false);
//if (!isCompanyOwnsWell)
// return Forbid();
if (!isCompanyOwnsWell)
return Forbid();
var content = await gtrRepository.GetAsync(idWell, begin,
intervalSec, approxPointsCount, token).ConfigureAwait(false);