feat(report):change report sts

This commit is contained in:
shahzeydyfah
2025-01-16 00:00:00 +03:30
parent 79d542381d
commit 6dcde300b1
3 changed files with 23 additions and 11 deletions
+19 -9
View File
@@ -15,6 +15,8 @@ class ReportRepository():
match.update({'design.type_id': _inp.type_id})
if _inp.nature_id:
match.update({'design.nature_id': _inp.nature_id})
if type == 'monitor' and _inp.monitor_type:
match.update({'monitor.base_information.type': _inp.monitor_type})
report = await use_collection(TaskEnv.CLN_PROJECT).aggregate([
{
"$match": match
@@ -66,16 +68,24 @@ class ReportRepository():
# return {'count_nature':count_nature,'count_type':count_type,'count_monitor_type':count_monitor_type}
return report
async def exist_project_state(self):
report = await use_collection(TaskEnv.CLN_PROJECT).aggregate([
{
'$group': {
'_id': "$design.state",
'count': {'$sum': 1}
}
async def exist_project_state(self,_inp: StatusReport):
match ={}
aggregate = []
if _inp.type_id:
match.update({'design.type_id': _inp.type_id})
if _inp.nature_id:
match.update({'design.nature_id': _inp.nature_id})
if _inp.monitor_type:
match.update({'monitor.base_information.type': _inp.monitor_type})
if match:
aggregate.append({"$match": match})
aggregate.append({
'$group': {
'_id': "$design.state",
'count': {'$sum': 1}
}
]).to_list(None)
})
report = await use_collection(TaskEnv.CLN_PROJECT).aggregate(aggregate).to_list(None)
return report
async def donut(self, _select: int):