feat: handle_date 根据work_time自动处理

This commit is contained in:
caoqianming 2024-09-05 09:29:49 +08:00
parent 982247ee70
commit 00853f395d
1 changed files with 7 additions and 0 deletions

View File

@ -391,6 +391,13 @@ class MlogSerializer(CustomModelSerializer):
if mtask:
if mtask.start_date == mtask.end_date:
attrs['handle_date'] = mtask.start_date
else:
if attrs['work_end_time']:
attrs['handle_date'] = attrs['work_end_time'].date()
elif attrs['work_start_time']:
attrs['handle_date'] = attrs['work_start_time'].date()
if attrs['handle_date'] >= mtask.start_date and attrs['handle_date'] <= mtask.end_date:
pass
else:
if attrs['handle_date'] >= mtask.start_date and attrs['handle_date'] <= mtask.end_date:
pass