fix(report):order progress_month_report
This commit is contained in:
@@ -412,15 +412,45 @@ class ReportRepository():
|
|||||||
to_date = datetime.combine(_inp.to_date.date(), time.max)
|
to_date = datetime.combine(_inp.to_date.date(), time.max)
|
||||||
from_date = _inp.from_date.combine(_inp.from_date.date(), time.min)
|
from_date = _inp.from_date.combine(_inp.from_date.date(), time.min)
|
||||||
result = await use_collection(TaskEnv.CLN_MONITOR_PYSICAL).aggregate([
|
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"},
|
"$group": {
|
||||||
'avg': {'$avg': "$real"}},
|
"_id": {
|
||||||
}
|
"year": "$year",
|
||||||
|
"month": "$month"
|
||||||
|
},
|
||||||
|
"avg": {
|
||||||
|
"$avg": "$real"
|
||||||
|
},
|
||||||
|
"sort_date": {
|
||||||
|
"$max": "$date_at"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$sort": {
|
||||||
|
"sort_date": -1
|
||||||
|
}
|
||||||
|
}
|
||||||
]).to_list(None)
|
]).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
|
return result
|
||||||
|
|
||||||
async def design_progress_status(self):
|
async def design_progress_status(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user