From 65fe3eb7b28cc33f61fdccfc8f5f1c64c24becca Mon Sep 17 00:00:00 2001
From: 5Amogh <amoghavarsh@navadhiti.com>
Date: Thu, 15 Dec 2022 18:25:13 +0530
Subject: [PATCH] Hotfix: Observation with rubric without criteria level report

---
 .../program-datasets.component.spec.data.ts   | 32 +++++++++++--------
 .../program-datasets.component.ts             |  4 +--
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.spec.data.ts b/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.spec.data.ts
index 563bae08a5..bb5eabfea9 100644
--- a/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.spec.data.ts
+++ b/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.spec.data.ts
@@ -55,6 +55,7 @@ export let mockData = {
       {
         _id: "5f34ec17585244939f89f90d",
         isRubricDriven: true,
+        criteriaLevelReport:true,
         externalId:
           "cbd074fa-dd11-11ea-a3bf-000d3af02677-OBSERVATION-TEMPLATE-1597303831612",
         name: "MH01-Mantra4Change-APSWREIS School Leader Feedback",
@@ -66,6 +67,7 @@ export let mockData = {
         _id: "5fbb75537380505718640436",
         type: "improvementproject",
         isRubricDriven: false,
+        criteriaLevelReport:false,
         subType: "",
         externalId: "7146aa30-2d67-11eb-b70e-55ade5205c81",
         name: "Health Awareness Project",
@@ -75,6 +77,7 @@ export let mockData = {
         _id: "5fbb75537380505718640437",
         type: "improvementproject",
         isRubricDriven: false,
+        criteriaLevelReport:false,
         subType: "",
         externalId: "71471f60-2d67-11eb-b70e-55ade5205c81",
         name: "Safe School Project",
@@ -84,6 +87,7 @@ export let mockData = {
         _id: "5fbb75537380505718640438",
         type: "survey",
         isRubricDriven: false,
+        criteriaLevelReport:false,
         subType: "",
         externalId: "71471f60-2d67-11eb-b70e-55ade5205c82",
         name: "Safe School survey",
@@ -105,20 +109,6 @@ export let mockData = {
         datasetId: "ml-improvementproject-status-report",
         roles: ["PM"],
       },
-    ],
-    observation: [
-      {
-        name: "Question Report",
-        encrypt: true,
-        datasetId: "ml-observation-question-report",
-        roles: ["PM"],
-      },
-      {
-        name: "Status Report",
-        encrypt: false,
-        datasetId: "ml-observation-status-report",
-        roles: ["PM"],
-      },
       {
         name: "Filtered task detail report",
         encrypt: true,
@@ -145,7 +135,21 @@ export let mockData = {
             defaultValue: 1,
           },
         ],
+      }
+    ],
+    observation: [
+      {
+        name: "Question Report",
+        encrypt: true,
+        datasetId: "ml-observation-question-report",
+        roles: ["PM"],
       },
+      {
+        name: "Status Report",
+        encrypt: false,
+        datasetId: "ml-observation-status-report",
+        roles: ["PM"],
+      }
     ],
     observation_with_rubric: [
       {
diff --git a/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.ts b/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.ts
index 39d60af958..f1136e6894 100644
--- a/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.ts
+++ b/src/app/client/src/app/modules/program-dashboard/components/program-datasets/program-datasets.component.ts
@@ -291,8 +291,8 @@ export class DatasetsComponent implements OnInit, OnDestroy {
       this.reportForm.controls.solution.setValue($event.value);
       this.reportForm.controls.programName.setValue(program);
       this.displayFilters['Resource'] = [$event?.source?.triggerValue]
-      if (solution[0].isRubricDriven == true && solution[0].type == 'observation') {
-        const type = solution[0].type + '_with_rubric';
+      if (solution[0].isRubricDriven === true && solution[0].type === 'observation') {
+        const type = solution[0].criteriaLevelReport ? solution[0].type + '_with_rubric' : solution[0].type + '_with_rubric_no_criteria_level_report'
         this.getReportTypes(this.programSelected, type);
       } else {
         this.getReportTypes(this.programSelected, solution[0].type);
-- 
GitLab