fix: cal_mpointstat_hour对于is_unit的计算错误
This commit is contained in:
parent
91e9ac38f6
commit
f97c99bf8a
|
@ -143,7 +143,7 @@ def cal_mpointstat_hour(mpointId: str, year: int, month: int, day: int, hour: in
|
|||
val_type = mpoint.val_type
|
||||
if mpoint.type == Mpoint.MT_AUTO:
|
||||
if mpoint.is_unit:
|
||||
val = MpLogx.objects.filter(mpoint=mpoint, timex__gte=dt, timex__lt=dt_hour_n).aggregate(Sum("val"))["val__sum"] or 0
|
||||
val = MpLogx.objects.filter(mpoint=mpoint, timex__gte=dt, timex__lt=dt_hour_n).aggregate(sum=Sum(f'val_{mpoint.val_type}'))["sum"] or 0
|
||||
else:
|
||||
mrs0 = MpLogx.objects.filter(mpoint=mpoint, timex__gte=dt_hour_p, timex__lte=dt).order_by("timex")
|
||||
mrs = MpLogx.objects.filter(mpoint=mpoint, timex__gte=dt, timex__lte=dt_hour_n).order_by("timex")
|
||||
|
|
Loading…
Reference in New Issue