Browse Source

fix a bug that doesn't receive null in target/adjust

chenhaiyang 4 years ago
parent
commit
00ea8375df
2 changed files with 3 additions and 2 deletions
  1. 2 2
      app/api/routers/targets.py
  2. 1 0
      app/models/domain/feedback.py

+ 2 - 2
app/api/routers/targets.py

@@ -23,7 +23,7 @@ async def readjust_target(
 ):
     try:
         if project_id == 'Pj1101050030':
-            if feedback:
+            if feedback != FeedbackValue.null:
                 controller = TemperatureAdjustmentController(project_id, space_id, feedback)
                 need_run_room_control = await controller.run()
             else:
@@ -84,7 +84,7 @@ async def readjust_target_v2(
         space_id: str = Query(..., max_length=50, regex='^Sp', alias='space-id'),
         feedback: Optional[FeedbackValue] = Query(None)
 ):
-    if feedback:
+    if feedback != FeedbackValue.null:
         try:
             controller = TemperatureAdjustmentController(project_id, space_id, feedback)
             need_run_room_control = await controller.run()

+ 1 - 0
app/models/domain/feedback.py

@@ -4,6 +4,7 @@ from enum import Enum
 
 
 class FeedbackValue(str, Enum):
+    null = 'null'
     a_little_cold = '1'
     so_cold = '2'
     a_little_hot = '3'