From ffa712e4c91e7544fbee1391879ca8f425818309 Mon Sep 17 00:00:00 2001 From: shahzeydyfah Date: Thu, 22 May 2025 13:14:30 +0330 Subject: [PATCH] fix(monitor physical):add before in last --- app/repositories/monitor_physical_progress.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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