Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging PM Shri related changes and other bug fixes from 5.0.3 to 5.0.5 #386

Merged
merged 33 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1664d28
Merge pull request #302 from Sunbird-cQube/dev
htvenkatesh Jul 11, 2023
605174c
Merge pull request #304 from Sunbird-cQube/dev
htvenkatesh Jul 12, 2023
9ec9b87
Merge pull request #306 from Sunbird-cQube/dev
htvenkatesh Jul 13, 2023
583db9b
Merge pull request #308 from Sunbird-cQube/dev
htvenkatesh Jul 13, 2023
78d168f
Merge pull request #310 from Sunbird-cQube/dev
htvenkatesh Jul 14, 2023
7254db5
Merge pull request #312 from Sunbird-cQube/dev
htvenkatesh Jul 14, 2023
eef779b
Merge pull request #316 from Sunbird-cQube/dev
htvenkatesh Jul 18, 2023
fe257de
Update tsconfig.json
htvenkatesh Jul 19, 2023
81e69b5
Merge pull request #318 from Sunbird-cQube/dev
htvenkatesh Jul 19, 2023
29c6f4f
Merge pull request #320 from Sunbird-cQube/staging
pandutibil Jul 19, 2023
98a4756
Merge pull request #322 from Sunbird-cQube/dev
htvenkatesh Jul 28, 2023
73820f2
Merge pull request #323 from Sunbird-cQube/dev
htvenkatesh Jul 28, 2023
2f82030
Merge pull request #325 from Sunbird-cQube/dev
htvenkatesh Jul 28, 2023
58791fc
Merge pull request #328 from Sunbird-cQube/dev
htvenkatesh Aug 1, 2023
415e02c
Merge pull request #330 from Sunbird-cQube/dev
htvenkatesh Aug 2, 2023
5ae2822
Merge pull request #332 from Sunbird-cQube/staging
pandutibil Aug 16, 2023
e03d232
PM Shri program reports are added
pandutibil Oct 13, 2023
97cc8a5
Query is updated in pm shri report
pandutibil Oct 13, 2023
a3a150a
Merge pull request #378 from pandutibil/pm_shri_v5.0.3-nvsk
pandutibil Oct 13, 2023
0de6910
Merge pull request #379 from Sunbird-cQube/release-v5.0.3-nvsk-staging
pandutibil Oct 16, 2023
2a7f258
PM shri logo and description details are added
pandutibil Oct 17, 2023
eebab49
Merge pull request #380 from pandutibil/pm_shri_v5.0.3-nvsk
pandutibil Oct 17, 2023
f562dca
Static big number metrics are added for PM SHREE
pandutibil Oct 20, 2023
4cf7045
PM SHREE map report indicator updated
pandutibil Oct 20, 2023
40a395a
Bug fixed in map report data implementation
pandutibil Oct 20, 2023
a3a9151
PM SHRI label updated in the reports
pandutibil Oct 20, 2023
2516223
Label changes for fiter panel selector and other configurations chang…
pandutibil Oct 25, 2023
7770a4c
Merge pull request #383 from pandutibil/pm_shri_v5.0.3-nvsk
pandutibil Oct 25, 2023
a07dcdb
Tooltip and marker issues are fixed in the map and PM SHRI reports
pandutibil Nov 2, 2023
9a7e8a5
Merge pull request #384 from pandutibil/pm_shri_v5.0.3-nvsk
pandutibil Nov 2, 2023
f4f0548
Issue fixed in the map group by in data service
pandutibil Nov 3, 2023
9364a4f
Merge pull request #385 from pandutibil/pm_shri_v5.0.3-nvsk
pandutibil Nov 3, 2023
cf7bcfd
Merge branch 'release-v5.0.3-nvsk' into dev
pandutibil Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var routes: Routes = [];
if (environment.loginNeeded) {
routes = [
{
path: '/', redirectTo: `summary-statistics`, pathMatch: 'full'
path: '', redirectTo: `summary-statistics`, pathMatch: 'full'
},
{
path: 'public', redirectTo: 'summary-statistics', pathMatch: 'full'
Expand Down Expand Up @@ -150,6 +150,15 @@ if (environment.loginNeeded) {
canLoad: [AuthGuard],
data: { nameSpace: 'nipun_bharat' }
},
{
path: 'pmShri',
loadChildren: () =>
import('./views/pm-shri/pm-shri.module').then(
(module) => module.PmShriModule
),
canLoad: [AuthGuard],
data: { nameSpace: 'pm_shri' }
},
],
},
];
Expand Down Expand Up @@ -320,6 +329,15 @@ else {
canLoad: [AuthGuard],
data: { nameSpace: 'nipun_bharat' }
},
{
path: 'pmShri',
loadChildren: () =>
import('./views/pm-shri/pm-shri.module').then(
(module) => module.PmShriModule
),
canLoad: [AuthGuard],
data: { nameSpace: 'pm_shri' }
},
],
},
];
Expand Down
7 changes: 3 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, HostListener } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError, Event, ActivatedRoute } from '@angular/router';
import { filter, map } from 'rxjs/operators';
import { Title } from '@angular/platform-browser';
Expand All @@ -18,7 +17,7 @@ declare var dataLayer: Array<any>;
export class AppComponent {
title = 'cQube National';
loadingDataImg: boolean = false;
constructor(private translate: TranslateService, private titleService: Title,
constructor(private titleService: Title,
private router: Router, private activatedRoute: ActivatedRoute, public config: AppConfig, private http: HttpClient, private pageTrackerService: PageTrackerService) {
// translate.setDefaultLang('en');
// translate.use('en');
Expand All @@ -45,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 @@ -112,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);
}
}
}
7 changes: 5 additions & 2 deletions src/app/core/config/configMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {config as quiz} from '../../views/ncert-quiz/config/quiz_config';
import{config as microImprovement} from '../../views/micro-improvements/config/microimprovements_config';
import {config as nipunBharatConfig } from '../../views/nipun-bharat/config/nipun_bharat_config';
import { config as telemetryConfig} from '../../views/telemetry/config/telemetry_config';
import {config as pmShriConfig } from '../../views/pm-shri/config/pm_shri_config';

export const configFiles = {
std_att: studentAttendaceConfig,
Expand All @@ -33,8 +34,8 @@ export const configFiles = {
quiz:quiz,
micro_improvements:microImprovement,
nipun_bharat:nipunBharatConfig,
telemetry:telemetryConfig

telemetry:telemetryConfig,
pm_shri: pmShriConfig
};

export const programFolderNames = {
Expand All @@ -51,6 +52,7 @@ export const programFolderNames = {
ncf:'ncf',
quiz:'quiz',
microImprovement:'microImprovement',
pmShri: 'pm_shri'
}

export const stateProgramsFolderNames = {
Expand All @@ -67,4 +69,5 @@ export const stateProgramsFolderNames = {
ncf:'',
quiz:'',
microImprovement:'',
pmShri: ''
}
2 changes: 0 additions & 2 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { MatTooltipModule, MatTooltipDefaultOptions, MAT_TOOLTIP_DEFAULT_OPTIONS
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { TranslocoCoreModule } from './transloco/transloco.module';
import { RouterModule } from '@angular/router';

import { LayoutComponent } from './components/layout/layout.component';
Expand Down Expand Up @@ -38,7 +37,6 @@ const DECLARATIONS = [
imports: [
CommonModule,
RouterModule,
TranslocoCoreModule,
NgxSpinnerModule,
MatTooltipModule,
IMPORTS
Expand Down
55 changes: 27 additions & 28 deletions src/app/core/services/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,31 @@ export class DataService {
return new Promise((resolve, reject) => {
this.spinner.show();
let { bigNumber } = options ?? {};
let { valueSuffix, property, title } = bigNumber ?? {};
let { valueSuffix, property, title, formatter } = bigNumber ?? {};
let reportData = {
...prevReportData,
valueSuffix: valueSuffix,
reportName: title
valueSuffix,
reportName: title,
formatter
}
if (indicator === 'averagePercentage') {

if (query === "" || isNaN(Number(query))) {
this._commonService.getReportDataNew(query).subscribe((res: any) => {
if (res) {
let rows = res;
reportData = {
...reportData,
averagePercentage: rows[0]?.[property]
[indicator]: rows[0]?.[property]
}
resolve(reportData)
}
})
}
else if (indicator === 'differencePercentage') {
this._commonService.getReportDataNew(query).subscribe((res: any) => {
if (res) {
let rows = res;
reportData = {
...reportData,
differencePercentage: rows[0]?.[property]
}
resolve(reportData)
}
})
});
} else {
reportData = {
...reportData,
[indicator]: !isNaN(Number(query)) ? Number(query) : query
}
resolve(reportData)
}
this.spinner.hide()
});
Expand Down Expand Up @@ -321,6 +317,10 @@ export class DataService {
tooltip: row.tooltip ? row.tooltip : this._wrapperService.constructTooltip(tooltipMetrics, row, metricFilter ? metricFilter.value : indicator)
};

if (indicator) {
row.indicator = isNaN(row[indicator]) ? row[indicator] : Number(row[indicator]);
}

return row;
}),
options: {
Expand Down Expand Up @@ -458,9 +458,8 @@ export class DataService {

mapGroupBy(data: any, groupByLabel: any, metricLabelProp: string, metricValueProp: string, tooltipMetrics: any, metricFilterValue: any) {
let result = _.chain(data).groupBy(groupByLabel).map((objs, key) => {
data = {
[groupByLabel]: key,
}
let row = objs.find(obj => obj[metricLabelProp] === metricFilterValue)

objs?.forEach((obj: any, index: any) => {
let modifiedTooltipMetrics = tooltipMetrics.filter(metric => metricLabelProp === metric.value).map((metric: any) => {
return {
Expand All @@ -469,18 +468,18 @@ export class DataService {
value: obj[metricLabelProp]
}
})
data = {
...data,
...obj,
// district_code: obj['district_id'] ? Number(obj['district_id']) : null,

row = {
...row,
[obj[metricLabelProp]]: obj[metricValueProp]
}

if (index === 0) {
data['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), data, metricFilterValue)
row['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), row, metricFilterValue)
}
data['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, data, metricFilterValue)
row['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, row, metricFilterValue)
});
return data;
return row;
}).value()
return result;
}
Expand Down
32 changes: 0 additions & 32 deletions src/app/core/transloco/transloco.http-loader.ts

This file was deleted.

50 changes: 0 additions & 50 deletions src/app/core/transloco/transloco.module.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/app/shared/components/big-number/big-number.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ export class BigNumberComponent implements OnInit, OnChanges {
differenceInPercentage: any;
differenceIndicator: any= undefined;
valueSuffix: any;
formatter: any;

constructor() { }

ngOnInit(): void {

}

ngOnChanges(): void {
this.updateValues();
}

updateValues(): void {
this.formatter = this.bigNumberReportData?.formatter;
this.averagePercentage = this.bigNumberReportData?.averagePercentage;
this.valueSuffix = this.bigNumberReportData?.valueSuffix ? this.bigNumberReportData?.valueSuffix : '';
if(this.bigNumberReportData && this.bigNumberReportData.differencePercentage && this.bigNumberReportData.averagePercentage) {
Expand All @@ -42,7 +44,7 @@ export class BigNumberComponent implements OnInit, OnChanges {
}

formatNumber(input: any) {
return formatNumberForReport(Number(input))
return formatNumberForReport(Number(input), this.formatter);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[name]="'filter-'+filter.name" [multiple]="isFilterMulti()" [closeOnSelect]="false"
placeholder="Select {{filter.name}}" [clearable]="resetOthers" [(ngModel)]="filter.value"
(ngModelChange)="onSelectOption($event, i, selectRef)" appChange>
<ng-option *ngFor="let option of filter.options" [value]="option.value">{{ option.label }}</ng-option>
<ng-option *ngFor="let option of filter.options" [value]="option.value">{{ convertNativeMetricLabelToReadable(option.label) }}</ng-option>
</ng-select>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ export class FilterPanelComponent implements OnInit, OnChanges {
isFilterMulti(): boolean {
return this.isMulti;
}

convertNativeMetricLabelToReadable(label: string): string {
if (typeof label !== 'string') {
return label;
}

return label.split('_').map(word => word[0]?.toUpperCase() + word?.substring(1).toLowerCase()).join(' ')
}
}
13 changes: 7 additions & 6 deletions src/app/utilities/NumberFomatter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { environment } from "src/environments/environment";

function formatNumber(number: number, config: any): string {
function formatNumber(number: number, formatter: any): string {

if (config.format === 'short') {
if (config.locale === 'en-IN') {
if (formatter.format === 'short') {
if (formatter.locale === 'en-IN') {
if (number < 1000) {
return `${number}`;
} else if (number > 999 && number <= 99999) {
Expand All @@ -26,7 +26,7 @@ function formatNumber(number: number, config: any): string {
}
}

return new Intl.NumberFormat(config.locale).format(number);
return new Intl.NumberFormat(formatter.locale).format(number);
}

function numberLabelFormat(number: number, config: any, axisRef?: any): string {
Expand Down Expand Up @@ -89,8 +89,9 @@ function removeFormat(string, config) {

}

export function formatNumberForReport(number: number): string {
return formatNumber(number, environment.numberFormat.reports);
export function formatNumberForReport(number: number, formatter?: any): string {
formatter = formatter ? formatter : environment.numberFormat.reports;
return formatNumber(number, formatter);
}

export function numberLabelFormatForReport(number: number, axisRef?: any): string {
Expand Down
Loading
Loading