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 changes from dev to saging #398

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions src/app/views/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,33 @@ export class DashboardComponent implements OnInit {
if (currentLevelFilter !== undefined) {
let metricQueries = currentLevelFilter?.actions?.queries;
let metricQueriesKeys = Object.keys(metricQueries);
console.log("cvbn:", { metricQueriesKeys, currentLevelFilter, metricQueries })
for (let k = 0; k < metricQueriesKeys?.length; k++) {
if (metrics.length >= 2) {
break;
}
else if (metricQueriesKeys[k].indexOf('bigNumber') > -1) {
let query = parseRbacFilter(metricQueries[metricQueriesKeys[k]], rbacDetails);
let bigNumberOptions = Array.isArray(programConfig[reports[i]]?.options?.bigNumber) ? programConfig[reports[i]]?.options?.bigNumber[rbacDetails.role] : programConfig[reports[i]]?.options?.bigNumber;
if (query === "" || isNaN(Number(query))) {
let res = await this._wrapperService.runQuery(query)
if (res && res.length > 0) {
let metricData = {
value: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k]] : String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix],
name: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.title) ? programConfig[reports[i]]?.options?.bigNumber?.title[k] : programConfig[reports[i]]?.options?.bigNumber?.title
value: Array.isArray(bigNumberOptions?.property) ? String(formatNumberForReport(res[0]?.[bigNumberOptions?.property[k]])) + [bigNumberOptions?.valueSuffix[k]] : String(formatNumberForReport(res[0]?.[bigNumberOptions?.property])) + [bigNumberOptions?.valueSuffix],
name: Array.isArray(bigNumberOptions?.title) ? bigNumberOptions?.title[k] : bigNumberOptions?.title
}
if((Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]] : res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property]) === null) {
metricData.value = Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.valueSuffix) ? '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k] : '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix
if((Array.isArray(bigNumberOptions?.property) ? res?.[0]?.[bigNumberOptions?.property[k]] : res?.[0]?.[bigNumberOptions?.property]) === null) {
metricData.value = Array.isArray(bigNumberOptions?.valueSuffix) ? '0' + bigNumberOptions?.valueSuffix[k] : '0' + bigNumberOptions?.valueSuffix
}
if (metricData.value !== null && metricData !== undefined) {
metrics.push(metricData)
// console.log(metricData.value)
}
}
} else {
const formatter = programConfig[reports[i]]?.options?.bigNumber?.formatter[k] ? programConfig[reports[i]]?.options?.bigNumber?.formatter[k] : programConfig[reports[i]]?.options?.bigNumber?.formatter;
const formatter = bigNumberOptions?.formatter[k] ? bigNumberOptions?.formatter[k] : bigNumberOptions?.formatter;
metrics.push({
value: !isNaN(metricQueries[metricQueriesKeys[k]]) ? formatNumberForReport(metricQueries[metricQueriesKeys[k]], formatter) : metricQueries[metricQueriesKeys[k]],
name: programConfig[reports[i]]?.options?.bigNumber?.title[k]
name: bigNumberOptions?.title[k]
});
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/app/views/diksha/config/diksha_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,7 @@ export const config = {
"hierarchyLevel": "0",
"actions": {
"queries": {
"bigNumber1": "6766",
"bigNumber2": "107000",
"bigNumber3": "332000",
"bigNumber4": "select count(distinct state_id) as total_states from datasets.diksha_energized_textbooks_state where sum > 0"
"bigNumber1": "select count(distinct state_id) as total_states from datasets.diksha_energized_textbooks_state where sum > 0"
},
"level": "district"
}
Expand All @@ -547,10 +544,9 @@ export const config = {
],
"options": {
"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 States/UTs Participating'],
"valueSuffix": [''],
"property": ['total_states']
}, {
"title": ['Total ETBs', 'Total QR Codes', 'Content Coverage on QR', 'Total States/UTs Participating', 'Total Content'],
"valueSuffix": ['', '', '%', '', ''],
Expand Down
Loading