Skip to content

Commit

Permalink
Merge pull request #392 from Sunbird-cQube/dev
Browse files Browse the repository at this point in the history
Merging changes from dev to staging
  • Loading branch information
pandutibil authored Nov 16, 2023
2 parents 53965d4 + 81e4123 commit 5b1efad
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
Expand Down Expand Up @@ -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);
}
}
}
2 changes: 1 addition & 1 deletion src/app/core/config/configMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 7 additions & 15 deletions src/app/views/authentication/pages/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 11 additions & 7 deletions src/app/views/diksha/config/diksha_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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', '']
}
}]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/app/views/ncf/config/ncf_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
13 changes: 7 additions & 6 deletions src/app/views/udise/config/udise_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 5b1efad

Please sign in to comment.