feat: shutdown_or_startup bug

This commit is contained in:
caoqianming 2023-09-01 15:48:19 +08:00
parent 3726b96759
commit a7b53bce2e
1 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import traceback
from apps.mtm.services import get_mgroup_goals
from django.db.models import Q
import datetime
from django.utils.timezone import now
from django.utils import timezone
def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour: int):
@ -81,10 +81,11 @@ def shutdown_or_startup(mplog: MpLog):
from apps.wpm.tasks import cal_shut_hour
mpoint = mplog.mpoint
mgroup = mpoint.mgroup
now = timezone.now()
if mplog.tag_val == 1 and mgroup.is_running is False:
# 从停到开
stlog = StLog.objects.filter(mgroup=mgroup).order_by('start_time').last()
stlog.end_time = now()
stlog.end_time = now
stlog.save()
mgroup.is_runing = True
mgroup.save()