From 5230306d2fc7ee40ad9b8b25ba46be7ba8c3e2a9 Mon Sep 17 00:00:00 2001 From: pandutibil Date: Thu, 16 Nov 2023 10:57:50 +0530 Subject: [PATCH] Updated the configurations for various programs --- src/app/app.component.ts | 4 ++-- src/app/core/config/configMapping.ts | 2 +- .../pages/login/login.component.ts | 22 ++++++------------- src/app/views/diksha/config/diksha_config.ts | 18 +++++++++------ .../etb-bignumbers.component.ts | 5 +++++ src/app/views/ncf/config/ncf_config.ts | 8 +++---- src/app/views/udise/config/udise_config.ts | 13 ++++++----- 7 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7c76d399..3777fc20 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -44,7 +44,7 @@ export class AppComponent { router.events.subscribe(event => { if (event instanceof NavigationEnd) { if (event.url !== '/login') { - //this.pageTrackerService.onPageChange(event); + this.pageTrackerService.onPageChange(event); } } }); @@ -111,7 +111,7 @@ export class AppComponent { @HostListener('window:beforeunload', ['$event']) handleUnload(event: Event): void { if (this.router.url !== '/login') { - //this.pageTrackerService.onPageChange(event); + this.pageTrackerService.onPageChange(event); } } } diff --git a/src/app/core/config/configMapping.ts b/src/app/core/config/configMapping.ts index d51b2f96..d3a58170 100644 --- a/src/app/core/config/configMapping.ts +++ b/src/app/core/config/configMapping.ts @@ -31,7 +31,7 @@ export const configFiles = { student_progression: progresConfig, assessment:studentAssessments, ncf:ncf, - quiz:quiz, + ncert_quiz:quiz, micro_improvements:microImprovement, nipun_bharat:nipunBharatConfig, telemetry:telemetryConfig, diff --git a/src/app/views/authentication/pages/login/login.component.ts b/src/app/views/authentication/pages/login/login.component.ts index cf83b0e9..c4b26a5b 100644 --- a/src/app/views/authentication/pages/login/login.component.ts +++ b/src/app/views/authentication/pages/login/login.component.ts @@ -68,7 +68,7 @@ export class LoginComponent implements OnInit { type userRoles = Array<{ id: number, text: string }> if (this.isLoggedIn) { - this.router.navigate(['/home']) + this.router.navigate(['/summary-statistics']) } if (environment.config === 'VSK') { @@ -123,27 +123,19 @@ export class LoginComponent implements OnInit { let results = await this._commonService.getUserAttributes(userId).toPromise(); let preferences = results?.['details'] let selectedRole = preferences?.['selectedRole'] - if (userRoles.includes('admin')) { - this.preferences = { role: environment.config === 'VSK' ? 1 : 0, } - this.setStateDetails(this.preferences) - this.router.navigate(['/summary-statistics']); - } - else if(environment.config === 'NVSK') { - this.setStateDetails({}) - this.router.navigate(['/summary-statistics']); - } - else if (preferences && preferences['selectedRole'] && (preferences['selectedRole'] == 1 || Object.keys(preferences).includes(String(selectedRole)))) { + + if (preferences && preferences['selectedRole'] && (preferences['selectedRole'] == 1 || Object.keys(preferences).includes(String(selectedRole)))) { this.preferences = { role: preferences['selectedRole'], ...preferences?.[selectedRole] } this.setStateDetails(preferences?.[selectedRole]) this.router.navigate(['/summary-statistics']); + } else { + this.preferences = { role: environment.config === 'VSK' ? 1 : 0, } + this.setStateDetails(this.preferences) + this.router.navigate(['/summary-statistics']); } - else { - this.router.navigate(['/home']); - } - }, err => { this.error = true; diff --git a/src/app/views/diksha/config/diksha_config.ts b/src/app/views/diksha/config/diksha_config.ts index a527bc0b..13b30bf9 100644 --- a/src/app/views/diksha/config/diksha_config.ts +++ b/src/app/views/diksha/config/diksha_config.ts @@ -521,11 +521,10 @@ export const config = { "hierarchyLevel": "0", "actions": { "queries": { - "bigNumber1": "select sum(sum) as total_etbs from datasets.diksha_resourcecount_textbookdiksha0grade0subject0medium", - "bigNumber2": "select sum(sum) as total_qr_codes from datasets.diksha_totalqrcodes_textbookdiksha0grade0subject0medium", - "bigNumber3": "select round(cast(avg(sum) as numeric),2) as content_coverage from datasets.diksha_qrcoverage_textbookdiksha0grade0subject0medium", - "bigNumber4": "select count(distinct state_id) as total_states from datasets.diksha_energized_textbooks_state where sum > 0", - "bigNumber5": "" + "bigNumber1": "6766", + "bigNumber2": "107000", + "bigNumber3": "332000", + "bigNumber4": "select count(distinct state_id) as total_states from datasets.diksha_energized_textbooks_state where sum > 0" }, "level": "district" } @@ -547,11 +546,16 @@ export const config = { }, ], "options": { - "bigNumber": { + "bigNumber": [{ + "title": ['Total ETBs', 'Total QR Codes', 'Total Content', 'Total States/UTs Participating'], + "valueSuffix": ['', '', '', ''], + "property": ['', '', '', 'total_states'], + "formatter": { locale: 'en-IN', format: "long" } + }, { "title": ['Total ETBs', 'Total QR Codes', 'Content Coverage on QR', 'Total States/UTs Participating', 'Total Content'], "valueSuffix": ['', '', '%', '', ''], "property": ['total_etbs', 'total_qr_codes', 'content_coverage', 'total_states', ''] - } + }] } } diff --git a/src/app/views/diksha/pages/etb-coverage-status-tab/reports/etb-bignumbers/etb-bignumbers.component.ts b/src/app/views/diksha/pages/etb-coverage-status-tab/reports/etb-bignumbers/etb-bignumbers.component.ts index 2a95bd44..f5a19fad 100644 --- a/src/app/views/diksha/pages/etb-coverage-status-tab/reports/etb-bignumbers/etb-bignumbers.component.ts +++ b/src/app/views/diksha/pages/etb-coverage-status-tab/reports/etb-bignumbers/etb-bignumbers.component.ts @@ -61,6 +61,7 @@ export class EtbBignumbersComponent implements OnInit { return true }) } + Object.keys(queries).forEach(async (key: any, index: any) => { if (key.toLowerCase().includes('comparison')) { let endDate = new Date(); @@ -75,6 +76,10 @@ export class EtbBignumbersComponent implements OnInit { let query = buildQuery(onLoadQuery, defaultLevel, this.levels, this.filters, this.startDate, this.endDate, key, this.compareDateRange); if (query && key.indexOf('bigNumber') > -1) { + if (Array.isArray(options?.bigNumber)) { + options.bigNumber = options?.bigNumber[Number(this.rbacDetails?.role)]; + } + let metricOptions = { bigNumber: { title: Array.isArray(options?.bigNumber?.title) ? options?.bigNumber?.title?.[index] : options?.bigNumber?.title, diff --git a/src/app/views/ncf/config/ncf_config.ts b/src/app/views/ncf/config/ncf_config.ts index d4ce0553..32d47baf 100644 --- a/src/app/views/ncf/config/ncf_config.ts +++ b/src/app/views/ncf/config/ncf_config.ts @@ -20,7 +20,7 @@ export const config = { "actions": { "queries": { - "map":"select t2.latitude, t2.longitude, t.state_id,state_name,t.category_name,sum(sum) as performance from datasets.ncf_categoryncf_state0categoryncf as t join dimensions.state as t2 on t.state_id = t2.state_id group by t.state_id,state_name,t.category_name, t2.latitude, t2.longitude" + "map":"select t2.latitude, t2.longitude, t.state_id,state_name,t.category_name,sum(sum) as performance from datasets.ncf_category_state0categoryncf as t join dimensions.state as t2 on t.state_id = t2.state_id group by t.state_id,state_name,t.category_name, t2.latitude, t2.longitude" }, "level": "state", "nextLevel": "district" @@ -145,9 +145,9 @@ export const config = { "hierarchyLevel": "0", "actions": { "queries": { - "bigNumber1": "select sum(sum) as total_dcr from datasets.ncf_categoryncf_state0categoryncf where category_name = 'dcr_completed_uploaded'", - "bigNumber2": "select sum(sum) as total_mobile_survey from datasets.ncf_categoryncf_state0categoryncf where category_name = 'mobile_survey_completed'", - "bigNumber3": "select sum(sum) as total_ndg from datasets.ncf_categoryncf_state0categoryncf where category_name = 'national_district_groups_created'", + "bigNumber1": "select sum(sum) as total_dcr from datasets.ncf_category_state0categoryncf where category_name = 'dcr_completed_uploaded'", + "bigNumber2": "select sum(sum) as total_mobile_survey from datasets.ncf_category_state0categoryncf where category_name = 'mobile_survey_completed'", + "bigNumber3": "select sum(sum) as total_ndg from datasets.ncf_category_state0categoryncf where category_name = 'national_district_groups_created'", "bigNumber4": "select sum(sum) as participants from datasets.ncf_number_of_participants_languagencf", }, "level": "state" diff --git a/src/app/views/udise/config/udise_config.ts b/src/app/views/udise/config/udise_config.ts index 8ba4cc4f..2073f12d 100644 --- a/src/app/views/udise/config/udise_config.ts +++ b/src/app/views/udise/config/udise_config.ts @@ -184,10 +184,10 @@ export const config = { "actions": { "queries": { "bigNumber1": "select sum(sum) as total_students from datasets.udise_no_of_students_state", - "bigNumber2": "select round(cast (avg(sum) as numeric),2) as ptr from datasets.udise_category_state0categoryudise where category_name = 'ptr'", - "bigNumber3": "select round(cast (avg(sum) as numeric),2) as schs_with_toilet from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_toilet'", - "bigNumber4": "select round(cast (avg(sum) as numeric),2) as schs_having_electricity from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_electricity'", - "bigNumber5": "select round(cast (avg(sum) as numeric),2) as schs_having_water from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_drinking_water'", + "bigNumber2": "select round(cast (avg(avg) as numeric),2) as ptr from datasets.udise_category_state0categoryudise where category_name = 'ptr'", + "bigNumber3": "select round(cast (avg(avg) as numeric),2) as schs_with_toilet from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_toilet'", + "bigNumber4": "select round(cast (avg(avg) as numeric),2) as schs_having_electricity from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_electricity'", + "bigNumber5": "select round(cast (avg(avg) as numeric),2) as schs_having_water from datasets.udise_category_state0categoryudise where category_name = '%_schools_having_drinking_water'", }, "level": "state" } @@ -228,7 +228,7 @@ export const config = { { "queries": { - "map": "select t2.latitude, t2.longitude, t2.state_name, t1.state_id, t1.state_id as level , t1.category_name,round(cast(sum(t1.sum) as numeric ),2) as percentage from datasets.udise_category_state0categoryudise as t1 join dimensions.state as t2 on t2.state_id = t1.state_id group by t1.state_id, t2.state_name,t1.category_name, t2.latitude, t2.longitude" + "map": "select t2.latitude, t2.longitude, t2.state_name, t1.state_id, t1.state_id as level, t1.category_name, sum(t1.sum) as category_value, round(cast(sum(t1.avg) as numeric ),2) as percentage from datasets.udise_category_state0categoryudise as t1 join dimensions.state as t2 on t2.state_id = t1.state_id group by t1.state_id, t2.state_name,t1.category_name, t2.latitude, t2.longitude" }, "level": "state", "nextLevel": "district" @@ -258,8 +258,9 @@ export const config = { { "indicatorType": "percent", "metricLabelProp": "category_name", - "metricValueProp": "percentage", + "metricValueProp": "category_value", "groupByColumn": "level", + "indicator": "percentage", "metricFilterNeeded": true, "legend": { "title": "District Wise Performance" }, "drillDownConfig": {