fix(monitor physical):add before in last

This commit is contained in:
shahzeydyfah
2025-05-22 13:14:30 +03:30
parent 0972289c63
commit ffa712e4c9
@@ -33,7 +33,13 @@ class PhysicalProgressRepository(BaseRepository):
return {}
async def last_record(self, _inp: LastRecord):
send = {'month': {}, 'three_month': {}}
send = {'month': {}, 'three_month': {}, 'before':{}}
before = await use_collection(TaskEnv.CLN_MONITOR_PYSICAL).find({
'project_id': _inp.project_id,
'date_at': {'$lt': _inp.date_at}
}).sort("$natural", -1).to_list(None)
if before:
send['before'] = before[0]
last = await self.search_last(TaskEnv.CLN_MONITOR_PYSICAL, _inp, 35, 25)
if last:
send['month'] = last