刘凡 2 years ago
parent
commit
3a8b6a162a

+ 1 - 0
apps/plan/views/planlistview.py

@@ -161,6 +161,7 @@ class PlanListView(APIView):
                 'creator': plan.creator.username,
                 'id': plan.id,
                 'title': plan.title,
+                'type': plan.type,
                 'description': plan.description,
                 'state': plan.state,
                 'create_time': plan.create_time,

+ 1 - 0
apps/plan/views/planview.py

@@ -63,6 +63,7 @@ class PlanView(APIView):
             'title': plan.title,
             'description': plan.description,
             'state': plan.state,
+            'type': plan.type,
             'tasks': tasks_info,
             'create_time': plan.create_time,
             'update_time': plan.update_time,

+ 17 - 14
apps/software/views/softwareplanview.py

@@ -36,21 +36,24 @@ class SoftwarePlanView(APIView):
 
         info = []
         plan_all = plan_all.filter(delete=False)
+        names = set()
         for plan in plan_all.all():
-            info.append({
-                'software_id': plan.software.id,
-                'software_name': plan.software.name,
-                'version': plan.version,
-                'creator_id': plan.creator.id,
-                'creator': plan.creator.username,
-                'id': plan.id,
-                'type': plan.type,
-                'title': plan.title,
-                'description': plan.description,
-                'state': plan.state,
-                'create_time': plan.create_time,
-                'update_time': plan.update_time,
-            })
+            if plan.title not in names:
+                names.add(plan.title)
+                info.append({
+                    'software_id': plan.software.id,
+                    'software_name': plan.software.name,
+                    'version': plan.version,
+                    'creator_id': plan.creator.id,
+                    'creator': plan.creator.username,
+                    'id': plan.id,
+                    'type': plan.type,
+                    'title': plan.title,
+                    'description': plan.description,
+                    'state': plan.state,
+                    'create_time': plan.create_time,
+                    'update_time': plan.update_time,
+                })
         return Response(info)