fix: enstat hour_s查询时按真实事件查询
This commit is contained in:
parent
adffac48ad
commit
757bf89d71
|
@ -50,10 +50,10 @@ class MpointStatFilter(filters.FilterSet):
|
||||||
start_year, start_month, start_day, start_hour = start_time.year, start_time.month, start_time.day, start_time.hour
|
start_year, start_month, start_day, start_hour = start_time.year, start_time.month, start_time.day, start_time.hour
|
||||||
if query["type"] in ["hour_s"]:
|
if query["type"] in ["hour_s"]:
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
Q(year_s__gt=start_year)
|
Q(year__gt=start_year)
|
||||||
| Q(year_s=start_year, month_s__gt=start_month)
|
| Q(year=start_year, month__gt=start_month)
|
||||||
| Q(year_s=start_year, month_s=start_month, day_s__gt=start_day)
|
| Q(year=start_year, month=start_month, day__gt=start_day)
|
||||||
| Q(year_s=start_year, month_s=start_month, day_s=start_day, hour__gte=start_hour)
|
| Q(year=start_year, month=start_month, day=start_day, hour__gte=start_hour)
|
||||||
)
|
)
|
||||||
elif query["type"] in ["sflog", "day_s"]:
|
elif query["type"] in ["sflog", "day_s"]:
|
||||||
queryset = queryset.filter(Q(year_s__gt=start_year) | Q(year_s=start_year, month_s__gt=start_month) | Q(year_s=start_year, month_s=start_month, day_s__gte=start_day))
|
queryset = queryset.filter(Q(year_s__gt=start_year) | Q(year_s=start_year, month_s__gt=start_month) | Q(year_s=start_year, month_s=start_month, day_s__gte=start_day))
|
||||||
|
@ -69,10 +69,10 @@ class MpointStatFilter(filters.FilterSet):
|
||||||
end_year, end_month, end_day, end_hour = end_time.year, end_time.month, end_time.day, end_time.hour
|
end_year, end_month, end_day, end_hour = end_time.year, end_time.month, end_time.day, end_time.hour
|
||||||
if query["type"] in ["hour_s"]:
|
if query["type"] in ["hour_s"]:
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
Q(year_s__lt=end_year)
|
Q(year__lt=end_year)
|
||||||
| Q(year_s=end_year, month_s__lt=end_month)
|
| Q(year=end_year, month__lt=end_month)
|
||||||
| Q(year_s=end_year, month_s=end_month, day_s__lt=end_day)
|
| Q(year=end_year, month=end_month, day__lt=end_day)
|
||||||
| Q(year_s=end_year, month_s=end_month, day_s=end_day, hour__lte=end_hour)
|
| Q(year=end_year, month=end_month, day=end_day, hour__lte=end_hour)
|
||||||
)
|
)
|
||||||
elif query["type"] in ["sflog", "day_s"]:
|
elif query["type"] in ["sflog", "day_s"]:
|
||||||
queryset = queryset.filter(Q(year_s__lt=end_year) | Q(year_s=end_year, month_s__lt=end_month) | Q(year_s=end_year, month_s=end_month, day_s__lte=end_day))
|
queryset = queryset.filter(Q(year_s__lt=end_year) | Q(year_s=end_year, month_s__lt=end_month) | Q(year_s=end_year, month_s=end_month, day_s__lte=end_day))
|
||||||
|
|
Loading…
Reference in New Issue