From 2061422c3cca31d444e92546d94d67dd298165da Mon Sep 17 00:00:00 2001
From: 5Amogh <amoghavarsh@navadhiti.com>
Date: Mon, 24 Oct 2022 12:23:13 +0530
Subject: [PATCH] Hotfix: Request and load status based on districts

---
 .../program-datasets/program-datasets.component.ts  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

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 e85529f332..66dd9de3f7 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
@@ -542,9 +542,11 @@ export class DatasetsComponent implements OnInit, OnDestroy {
   }
 
   districtSelection($event) {
-    this.globalDistrict = $event.value
+    this.globalDistrict = $event.value;
     this.reportForm.controls.districtName.setValue($event.value);
     this.displayFilters['District'] = [$event?.source?.triggerValue]
+    this.tag =  _.get(this.reportForm, 'controls.solution.value')+ '_' + this.userId+'_'+ _.toLower(_.trim([$event?.source?.triggerValue]," "));
+    this.loadReports();
   }
 
   organisationSelection($event) {
@@ -645,7 +647,6 @@ export class DatasetsComponent implements OnInit, OnDestroy {
                 }
 
               });
-
               if (dataFound && dataFound.length > 0) {
                 this.popup = false;
                 this.isProcessed = true;
@@ -707,8 +708,12 @@ export class DatasetsComponent implements OnInit, OnDestroy {
     let requestStatus = true;
     const selectedReportList = [];
     _.forEach(this.onDemandReportData, (value) => {
-      if (value.datasetConfig.type == this.selectedReport.datasetId && value.datasetConfig.params.solutionId == this.selectedSolution) {
-        selectedReportList.push(value);
+      if (value.datasetConfig.type == this.selectedReport.datasetId){
+        _.forEach(value.datasetConfig.params.filters, (filter) => {
+          if(['solutionId','solution_id'].includes(filter['dimension']) && filter.value  === this.selectedSolution){
+            selectedReportList.push(value);
+          }
+        });
       }
     });
     const sortedReportList = _.sortBy(selectedReportList, [(data) => {
-- 
GitLab