fix(report):order progress_month_report

This commit is contained in:
shahzeydyfah
2026-08-17 21:38:03 +03:30
parent 439f7b3c15
commit 4ddac54ab7
+36 -6
View File
@@ -412,15 +412,45 @@ class ReportRepository():
to_date = datetime.combine(_inp.to_date.date(), time.max)
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}
"$match": {
"date_at": {
"$lte": to_date,
"$gte": from_date
}
}
},
{"$group":
{'_id': {"year": "$year", "month": "$month"},
'avg': {'$avg': "$real"}},
}
{
"$group": {
"_id": {
"year": "$year",
"month": "$month"
},
"avg": {
"$avg": "$real"
},
"sort_date": {
"$max": "$date_at"
}
}
},
{
"$sort": {
"sort_date": -1
}
}
]).to_list(None)
# 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"}},
# }
# ]).to_list(None)
return result
async def design_progress_status(self):