浏览代码

rename field service_type to service_category

blezz-tech 1 月之前
父节点
当前提交
b9c0394091
共有 3 个文件被更改,包括 10 次插入10 次删除
  1. 7 7
      handlers/classes/Order.py
  2. 1 1
      handlers/classes/OrderTicket.py
  3. 2 2
      serializer/orders_local.py

+ 7 - 7
handlers/classes/Order.py

@@ -10,7 +10,7 @@ class Order(object):
             is_global,
             is_visible,
             service,
-            service_type,
+            service_category,
             time_created,
             time_placed,
             time_start=None,
@@ -53,7 +53,7 @@ class Order(object):
         self.is_global = is_global
         self.is_visible = is_visible
         self.service = service
-        self.service_type = service_type
+        self.service_category = service_category
         self.time_created = time_created
         self.time_placed = time_placed
         self.time_start = time_start
@@ -98,7 +98,7 @@ class Order(object):
             self.is_global,
             self.is_visible,
             self.service,
-            self.service_type,
+            self.service_category,
             self.time_created,
             self.time_placed,
             self.time_start,
@@ -153,7 +153,7 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 "is_global": false,
 "is_visible": false,
 "service": 1,
-"service_type": 1,
+"service_category": 1,
 
 "status_changed_date": "2023-05-15T17:16:22.955601Z",
 "time_placed": "2023-05-15T16:40:32.179777Z",
@@ -192,7 +192,7 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 '''
 # надо адаптировать класс к новому формату JSON
 # class Order(object):
-#     def __init__(self, id,order_synced, ticket, status, title, note, due_date, id_metaservice, is_global, is_visible, service, service_type, status_changed_date,time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client=None, resource=None, attempts=None, asap=None):
+#     def __init__(self, id,order_synced, ticket, status, title, note, due_date, id_metaservice, is_global, is_visible, service, service_category, status_changed_date,time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client=None, resource=None, attempts=None, asap=None):
 #         self.order_synced = order_synced
 #         self.id = id
 #         self.ticket = ticket
@@ -206,7 +206,7 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 #         self.is_global = is_global
 #         self.is_visible = is_visible
 #         self.service = service
-#         self.service_type = service_type
+#         self.service_category = service_category
 
 #         self.status_changed_date = status_changed_date
 #         self.time_created = time_created
@@ -243,6 +243,6 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 #         self.asap = asap
 #         #доделать до конца по аналогии с закоммиченным json
 #     def __str__(self):
-#         return "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32} , {33} ,{34}".format(self.order_synced, self.id, self.ticket, self.status, self.title, self.note, self.due_date, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_type, self.status_changed_date, self.time_created,self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client, self.resource, self.attempts, self.asap)
+#         return "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32} , {33} ,{34}".format(self.order_synced, self.id, self.ticket, self.status, self.title, self.note, self.due_date, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_category, self.status_changed_date, self.time_created,self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client, self.resource, self.attempts, self.asap)
 
 # \n добавляете в местах с пустой строкой в шаблоне

+ 1 - 1
handlers/classes/OrderTicket.py

@@ -33,7 +33,7 @@ class OrderTicket(object):
         "status_changed_date": "2023-05-15T17:16:22.955601Z",
         "priority": 0,
         "title": "Test",
-        "note": "{\n    \n    \"ticket\": 1,\n    \"state\": 1,\n    \"id_metaservice\": 1,\n    \"is_global\": false,\n    \"is_visible\": false,\n    \"service\": 1,\n    \"service_type\": 1,\n\n    \"time_placed\": 1}"
+        "note": "{\n    \n    \"ticket\": 1,\n    \"state\": 1,\n    \"id_metaservice\": 1,\n    \"is_global\": false,\n    \"is_visible\": false,\n    \"service\": 1,\n    \"service_category\": 1,\n\n    \"time_placed\": 1}"
         "due_date": "2023-05-15",
         "task_list": 10,
         "created_by": 1,

+ 2 - 2
serializer/orders_local.py

@@ -21,8 +21,8 @@ class OrdersLocalSerializer(serializers.ModelSerializer):
         source="order_synced.service.pk",
         allow_null=True
     )
-    service_type = serializers.IntegerField(
-        source="order_synced.service_type.pk",
+    service_category = serializers.IntegerField(
+        source="order_synced.service_category.pk",
         allow_null=True
     )
     state = serializers.CharField(