Samson Mutunga 3 سال پیش
والد
کامیت
2809ef93f1
2فایلهای تغییر یافته به همراه11 افزوده شده و 3 حذف شده
  1. 7 0
      app/Http/Controllers/ClauseController.php
  2. 4 3
      spec/stat-tree-report-builder-spec.txt

+ 7 - 0
app/Http/Controllers/ClauseController.php

@@ -7,6 +7,9 @@ use App\Models\Clause;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Support\Facades\DB;
 use Ramsey\Uuid\Uuid;
+use App\Models\StatTree;
+use App\Models\StatTreeLine;
+use App\Models\StatTreeLineClause;
 
 class ClauseController extends Controller
 {
@@ -33,6 +36,10 @@ class ClauseController extends Controller
         $rows = json_decode($data);
 
         Clause::truncate();
+        //Should we truncate related data?
+        StatTree::truncate();
+        StatTreeLine::truncate();
+        StatTreeLineClause::truncate();
 
         for($i = 0; $i < count($rows); $i++){
             $row = $rows[$i];

+ 4 - 3
spec/stat-tree-report-builder-spec.txt

@@ -10,7 +10,7 @@
 			EXAMPLE:
 
 				MODEL | QUESTION / LABEL | ANSWER | CLAUSE_TEXT
-
+[MODEL][TAB][QUESTION][TAB][ANSWER][TAB][QUERY]
 Client	Active?	YES	(is_active IS TRUE)
 Client	Active?	NO	(is_active IS FALSE)
 Client	MCP assigned?	YES	(mcp_pro_id IS NOT NULL)
@@ -46,7 +46,8 @@ Pro	Is HCP?	NO	(is_hcp IS NOT TRUE)
 		tsv_text_for_lines
 
 			EXAMPLE tsv_text_for_lines:
-
+			
+[QUESTION][SPACE][ANSWER]
 Active? YES
 	MCP assigned? YES
 		MCB Primary? NO
@@ -62,7 +63,7 @@ Active? NO
 		Has active RM device? NO
 	Has active RM device? YES
 	Has active RM device? NO
-
+//Pros
 Active? YES
 	Is HCP? YES
 	Is HCP? NO