feat(progress physical):add avg
This commit is contained in:
@@ -38,6 +38,14 @@ class PhysicalProgressRepository(BaseRepository):
|
|||||||
three_month = await self.search_last(TaskEnv.CLN_MONITOR_PYSICAL, _inp, 95, 85)
|
three_month = await self.search_last(TaskEnv.CLN_MONITOR_PYSICAL, _inp, 95, 85)
|
||||||
if three_month:
|
if three_month:
|
||||||
send['three_month'] = three_month
|
send['three_month'] = three_month
|
||||||
|
_avg = await use_collection(TaskEnv.CLN_MONITOR_PYSICAL).aggregate([
|
||||||
|
{'$match':{'project_id':_inp.project_id}},
|
||||||
|
{'$group': {'_id': None, 'avg': {'$avg': "$real"}}}
|
||||||
|
]).to_list(None)
|
||||||
|
if _avg:
|
||||||
|
send['avg'] = _avg[0]['avg']
|
||||||
|
else:
|
||||||
|
send['avg'] = None
|
||||||
return send
|
return send
|
||||||
|
|
||||||
async def create(self, _inp: MODEL):
|
async def create(self, _inp: MODEL):
|
||||||
|
|||||||
Reference in New Issue
Block a user