From 45db6ca9f7e16518efffb750ab31643f2eb79066 Mon Sep 17 00:00:00 2001 From: Ajoymaity Date: Tue, 13 Feb 2024 20:35:21 +0530 Subject: [PATCH] Issue #ED-3456 fix: Fixed QR code and telemetry issue --- src/app/profile/guest-edit/guest-edit.page.ts | 10 ++++++++-- src/app/search/search.page.ts | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/app/profile/guest-edit/guest-edit.page.ts b/src/app/profile/guest-edit/guest-edit.page.ts index 12365eaa80..3b0775ebc3 100644 --- a/src/app/profile/guest-edit/guest-edit.page.ts +++ b/src/app/profile/guest-edit/guest-edit.page.ts @@ -173,7 +173,7 @@ export class GuestEditPage implements OnInit, OnDestroy { }); this.previousProfileType = this.profile.profileType; - this.profileForTelemetry = Object.assign({}, this.profile); + this.profileForTelemetry = Object.assign({}, JSON.parse(this.profile.categories)); this.defaultFrameworkID = this.profile.syllabus[0] } @@ -407,7 +407,13 @@ export class GuestEditPage implements OnInit, OnDestroy { async onCategoryChanged(category, event, index) { let currentValue = Array.isArray(event) ? event : [event]; if (currentValue.length) { - this.generateInteractTelemetry(Array.isArray(event) ? event : [event], category.code) + const oldAttribute: any = {}; + const newAttribute: any = {}; + oldAttribute[category.code] = this.profileForTelemetry[category.identifier] ? this.profileForTelemetry[category.identifier] : ''; + newAttribute[category.code] = event ? event : ''; + if (!isEqual(oldAttribute, newAttribute)) { + this.appGlobalService.generateAttributeChangeTelemetry(oldAttribute, newAttribute, PageId.GUEST_PROFILE); + } if (index !== this.categories.length - 1) { if (index === 0) { event = Array.isArray(event) ? event[0] : event; diff --git a/src/app/search/search.page.ts b/src/app/search/search.page.ts index 3073efc9a7..74767715d6 100644 --- a/src/app/search/search.page.ts +++ b/src/app/search/search.page.ts @@ -1948,10 +1948,15 @@ export class SearchPage implements OnInit, AfterViewInit, OnDestroy, OnTabViewWi if (e.index === 1) { req[e.identifier] = [content.framework]; } else { - let terms = this.categories.find(ele => e.code === ele.code).terms; - let code = content[e.code] || content[e.alterNativeCode] + let category = this.categories.find(ele => e.code === ele.code); + let terms = category ? category.terms : undefined + if (terms) { + let code = content[e.code] || content[e.alterNativeCode]; code = Array.isArray(code) ? code[0] : code; req[e.identifier] = [terms.find((ter) => ter.name === code || ter.identifier === code).code]; + } else { + req[e.identifier] = content[e.code] || content[e.alterNativeCode]; + } } }); resolve(req);