feat(report):add status agreement
This commit is contained in:
@@ -402,6 +402,9 @@ class ReportRepository():
|
||||
from_date = _inp.from_date.combine(_inp.from_date.date(), time.min)
|
||||
result = await use_collection(TaskEnv.CLN_MONITOR_PYSICAL).aggregate([
|
||||
{"$match":{"date_at":{"$lte":to_date,"$gte":from_date}}},
|
||||
{
|
||||
"$sort": {'date_at': -1}
|
||||
},
|
||||
{"$group":
|
||||
{'_id': {"year": "$year", "month": "$month"},
|
||||
'avg': {'$avg': "$real"}},
|
||||
@@ -432,6 +435,23 @@ class ReportRepository():
|
||||
}
|
||||
]).to_list(None)
|
||||
return result
|
||||
#روند وضعیت پروژه ها
|
||||
async def design_progress_status_progress(self):
|
||||
result = await use_collection("design_progress").aggregate([
|
||||
{'$match':{'complete_at':{"$exists":0},'parent_id':{"$exists":0}}},
|
||||
{"$group":
|
||||
{'_id': {"created_at": {
|
||||
"$dateToString": {
|
||||
"format": "%Y-%m-%d", # Format to extract date only (YYYY-MM-DD)
|
||||
"date": "$created_at"
|
||||
}
|
||||
},'type':'$type'},
|
||||
'count': {'$sum': 1},
|
||||
"projectIds": {"$addToSet": "$project_id"},
|
||||
},
|
||||
}
|
||||
]).to_list(None)
|
||||
return result
|
||||
|
||||
async def design_sts(self):
|
||||
result = await use_collection(TaskEnv.CLN_PROJECT).aggregate([
|
||||
@@ -446,6 +466,27 @@ class ReportRepository():
|
||||
]).to_list(None)
|
||||
return result
|
||||
|
||||
async def status_agreement_progress(self):
|
||||
result = await use_collection(TaskEnv.CLN_PROJECT_AGREEMENT).aggregate([
|
||||
{
|
||||
"$group": {
|
||||
"_id": {
|
||||
"created_at": {
|
||||
"$dateToString": {
|
||||
"format": "%Y-%m-%d", # Format to extract date only (YYYY-MM-DD)
|
||||
"date": "$created_at"
|
||||
}
|
||||
},
|
||||
"status": "$status"
|
||||
},
|
||||
"count": {"$sum": 1},
|
||||
"projectIds": {"$addToSet": "$_id"}
|
||||
}
|
||||
}
|
||||
]).to_list(None)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user