@@ -153,6 +153,7 @@ def eqpt_result(request): |
||
| 153 | 153 |
logs = ThermometerMeasureInfo.objects.filter( |
| 154 | 154 |
point_id=point_id, |
| 155 | 155 |
point_measure_ymd=tc.local_string(format='%Y-%m-%d'), |
| 156 |
+ point_measure_window=point.previous_measure_window, |
|
| 156 | 157 |
macid__in=macids, |
| 157 | 158 |
status=True, |
| 158 | 159 |
).values('macid', 'temperature')
|
@@ -199,7 +200,7 @@ def screen_eqpt_result(request): |
||
| 199 | 200 |
logs = ThermometerMeasureInfo.objects.filter( |
| 200 | 201 |
point_id=point_id, |
| 201 | 202 |
point_measure_ymd=tc.local_string(format='%Y-%m-%d'), |
| 202 |
- point_measure_window=point.point_measure_window, |
|
| 203 |
+ point_measure_window=point.previous_measure_window, |
|
| 203 | 204 |
macid__in=macids, |
| 204 | 205 |
status=True, |
| 205 | 206 |
).values('macid', 'temperature')
|
@@ -118,7 +118,19 @@ class IsolationPointInfo(BaseModelMixin): |
||
| 118 | 118 |
start_t, end_t = window.get('start'), window.get('end')
|
| 119 | 119 |
start_dt = tc.string_to_utc_datetime(f'{current_ymd} {start_t}:00')
|
| 120 | 120 |
end_dt = tc.string_to_utc_datetime(f'{current_ymd} {end_t}:00')
|
| 121 |
- if tc.utc_datetime(start_dt, minutes=-30) < current_dt < tc.utc_datetime(end_dt, minutes=30): |
|
| 121 |
+ if tc.utc_datetime(start_dt) < current_dt < tc.utc_datetime(end_dt): |
|
| 122 |
+ return f'{start_t}-{end_t}'
|
|
| 123 |
+ return '' |
|
| 124 |
+ |
|
| 125 |
+ @property |
|
| 126 |
+ def previous_measure_window(self): |
|
| 127 |
+ current_ymd = tc.local_string(format='%Y-%m-%d') |
|
| 128 |
+ current_dt = tc.utc_datetime() |
|
| 129 |
+ for window in self.point_measure_window: |
|
| 130 |
+ start_t, end_t = window.get('start'), window.get('end')
|
|
| 131 |
+ start_dt = tc.string_to_utc_datetime(f'{current_ymd} {start_t}:00')
|
|
| 132 |
+ end_dt = tc.string_to_utc_datetime(f'{current_ymd} {end_t}:00')
|
|
| 133 |
+ if tc.utc_datetime(start_dt, minutes=60) < current_dt < tc.utc_datetime(end_dt, minutes=60): |
|
| 122 | 134 |
return f'{start_t}-{end_t}'
|
| 123 | 135 |
return '' |
| 124 | 136 |
|