diff --git a/app/repositories/monitor_physical_progress.py b/app/repositories/monitor_physical_progress.py index f275261..15677e9 100644 --- a/app/repositories/monitor_physical_progress.py +++ b/app/repositories/monitor_physical_progress.py @@ -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