feat(api): StatTemplateDistributor дополнена статистика активированными, деактивированными шаблонами
This commit is contained in:
@@ -52,12 +52,19 @@ namespace PARR.API.Controllers.V1.Statistics
|
||||
{
|
||||
WorkGroupId = x.Key,
|
||||
CountTemplates = x.Count(),
|
||||
IsActivatedAllCount = x.Count(t => t.IsActiveTemplate && t.IsActiveSchedule),
|
||||
IsDeactivatedAllCount = x.Count(t => !t.IsActiveTemplate || !t.IsActiveSchedule || (!t.IsActiveTemplate && !t.IsActiveSchedule)),
|
||||
GroupingByDate =
|
||||
x.GroupBy(d => d.NextRun).OrderBy(d => d.Key).Select(d =>
|
||||
new
|
||||
{
|
||||
Date = d.Key,
|
||||
Count = d.Count()
|
||||
//Всего
|
||||
Count = d.Count(),
|
||||
//Только активированных
|
||||
IsActivatedCount = d.Count(t => t.IsActiveTemplate && t.IsActiveSchedule),
|
||||
//Только деактивированных
|
||||
IsDeactivatedCount = d.Count(t => !t.IsActiveTemplate || !t.IsActiveSchedule || (!t.IsActiveTemplate && !t.IsActiveSchedule))
|
||||
}
|
||||
)
|
||||
|
||||
@@ -74,8 +81,16 @@ namespace PARR.API.Controllers.V1.Statistics
|
||||
var response = statResult.Select(stat => new StatTemplateDistributorResponse
|
||||
{
|
||||
WorkGroup = mapper.Map<WorkGroupResponse>(workGroups.FirstOrDefault(x => x.Id == stat.WorkGroupId)),
|
||||
CountTemplates = stat.CountTemplates,
|
||||
Stat = stat.GroupingByDate.Select(x => new StatTemplateDistributorDateStat { Count = x.Count, Date = x.Date }).ToList()
|
||||
AllCount = stat.CountTemplates,
|
||||
IsActivatedAllCount = stat.IsActivatedAllCount,
|
||||
IsDeactivatedAllCount = stat.IsDeactivatedAllCount,
|
||||
Stat = stat.GroupingByDate.Select(x => new StatTemplateDistributorDateStat
|
||||
{
|
||||
AllCount = x.Count,
|
||||
Date = x.Date,
|
||||
IsActivatedCount = x.IsActivatedCount,
|
||||
IsDeactivatedCount = x.IsDeactivatedCount
|
||||
}).ToList()
|
||||
})
|
||||
.OrderBy(t => t.WorkGroup?.Name)
|
||||
.ToList();
|
||||
|
||||
Reference in New Issue
Block a user