fix: mpoitstat correct 时调用错误3
This commit is contained in:
parent
ee77a60d32
commit
1574499874
|
@ -367,10 +367,10 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
||||||
sflog = get_sflog(mgroup, dt)
|
sflog = get_sflog(mgroup, dt)
|
||||||
if sflog:
|
if sflog:
|
||||||
year_s, month_s, day_s = sflog.get_ymd
|
year_s, month_s, day_s = sflog.get_ymd
|
||||||
team = sflog.team
|
team = sflog.team
|
||||||
# 如果没有班组,那么month_st无需计算
|
# 如果没有班组,那么month_st无需计算
|
||||||
if team is None and type == "month_st":
|
if team is None and type == "month_st":
|
||||||
return year_s, month_s, day_s
|
return year_s, month_s, day_s
|
||||||
if type == "hour_s":
|
if type == "hour_s":
|
||||||
enstat, _ = EnStat.objects.get_or_create(
|
enstat, _ = EnStat.objects.get_or_create(
|
||||||
type="hour_s",
|
type="hour_s",
|
||||||
|
|
|
@ -124,15 +124,14 @@ class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, CustomListM
|
||||||
|
|
||||||
修正测点统计记录及统计值
|
修正测点统计记录及统计值
|
||||||
"""
|
"""
|
||||||
instance = self.get_object()
|
instance: MpointStat = self.get_object()
|
||||||
sr = MpointStatCorrectSerializer(data=request.data)
|
sr = MpointStatCorrectSerializer(data=request.data)
|
||||||
sr.is_valid(raise_exception=True)
|
sr.is_valid(raise_exception=True)
|
||||||
vdata = sr.validated_data
|
vdata = sr.validated_data
|
||||||
val_correct = vdata["val_correct"]
|
val_correct = vdata["val_correct"]
|
||||||
if val_correct:
|
instance.val_correct = val_correct
|
||||||
instance.val_correct = val_correct
|
instance.val = val_correct
|
||||||
instance.val = val_correct
|
instance.save(update_by=request.user)
|
||||||
instance.save()
|
|
||||||
mpoint, sflog, mgroup, year_s, month_s, day_s = instance.mpoint, instance.sflog, instance.mgroup, instance.year_s, instance.month_s, instance.day_s
|
mpoint, sflog, mgroup, year_s, month_s, day_s = instance.mpoint, instance.sflog, instance.mgroup, instance.year_s, instance.month_s, instance.day_s
|
||||||
# sflog 可能为None
|
# sflog 可能为None
|
||||||
if sflog is None:
|
if sflog is None:
|
||||||
|
|
Loading…
Reference in New Issue