From eef76f0b08c927c5239f156fa0d547cfb03efa61 Mon Sep 17 00:00:00 2001 From: Vishwa suresh Date: Fri, 17 Dec 2021 16:10:43 +0530 Subject: [PATCH 1/4] Issue #SB-28022 feat : QR Code Capability for Projects --- src/services/qrscanresulthandler.service.ts | 226 +++++++++++++++++++- src/services/sunbirdqrscanner.service.ts | 2 +- 2 files changed, 222 insertions(+), 6 deletions(-) diff --git a/src/services/qrscanresulthandler.service.ts b/src/services/qrscanresulthandler.service.ts index dabb83317..9b85e3eb5 100644 --- a/src/services/qrscanresulthandler.service.ts +++ b/src/services/qrscanresulthandler.service.ts @@ -10,7 +10,7 @@ import { TelemetryObject, TelemetryService, } from 'sunbird-sdk'; -import { EventTopics, RouterLinks } from '../app/app.constant'; +import { EventTopics, RouterLinks,MimeType } from '../app/app.constant'; import { CommonUtilService } from './common-util.service'; import { @@ -32,6 +32,9 @@ import { FormAndFrameworkUtilService } from './formandframeworkutil.service'; import { ContentUtil } from '@app/util/content-util'; import * as qs from 'qs'; import { NavigationService } from './navigation-handler.service'; +import { FormConstants } from '@app/app/form.constants'; +import { SbProgressLoader, Context as SbProgressLoaderContext } from './sb-progress-loader.service'; +import { CsPrimaryCategory } from '@project-sunbird/client-services/services/content'; declare var cordova; @@ -41,7 +44,8 @@ export class QRScannerResultHandler { source: string; inAppBrowserRef: any; scannedUrlMap: object; - + private progressLoaderId: string; + private enableRootNavigation = false; constructor( @Inject('CONTENT_SERVICE') private contentService: ContentService, @Inject('TELEMETRY_SERVICE') private telemetryService: TelemetryService, @@ -54,7 +58,8 @@ export class QRScannerResultHandler { private events: Events, private appGlobalService: AppGlobalService, private formFrameWorkUtilService: FormAndFrameworkUtilService, - private navService: NavigationService + private navService: NavigationService, + private sbProgressLoader: SbProgressLoader ) { } @@ -280,7 +285,6 @@ export class QRScannerResultHandler { generateEndEvent(pageId: string, qrData: string) { if (pageId) { const telemetryObject = new TelemetryObject(qrData, QRScannerResultHandler.CORRELATION_TYPE, undefined); - this.telemetryGeneratorService.generateEndTelemetry( QRScannerResultHandler.CORRELATION_TYPE, Mode.PLAY, @@ -301,4 +305,216 @@ export class QRScannerResultHandler { undefined, corRelationList); } -} + + // Lesser the value higher the priority + private validateDeeplinkPriority(matchedDeeplinkConfig, config) { + return (matchedDeeplinkConfig && !matchedDeeplinkConfig.priority && config.priority) || + (matchedDeeplinkConfig && matchedDeeplinkConfig.priority + && config.priority && matchedDeeplinkConfig.priority > config.priority); + } + + async manageLearScan(scannedData){ + const dailcode = await this.parseDialCode(scannedData); + const deepLinkUrlConfig: { name: string, code: string, pattern: string, route: string, priority?: number, params?: {} }[] = + await this.formFrameWorkUtilService.getFormFields(FormConstants.DEEPLINK_CONFIG); + let matchedDeeplinkConfig: { name: string, code: string, pattern: string, route: string, priority?: number } = null; + let urlMatch; + deepLinkUrlConfig.forEach(config => { + const urlRegexMatch = scannedData.match(new RegExp(config.pattern)); + if (!!urlRegexMatch && (!matchedDeeplinkConfig || this.validateDeeplinkPriority(matchedDeeplinkConfig, config))) { + if (config.code === 'profile' && !this.appGlobalService.isUserLoggedIn()) { + config.route = 'tabs/guest-profile'; + } + matchedDeeplinkConfig = config; + urlMatch = urlRegexMatch; + } + }); + + if (!matchedDeeplinkConfig) { + return; + } + let identifier; + if (urlMatch && urlMatch.groups && Object.keys(urlMatch.groups).length) { + identifier = urlMatch.groups.quizId || urlMatch.groups.content_id || urlMatch.groups.course_id; + } + const attributeConfig = deepLinkUrlConfig.find(config => config.code === 'attributes'); + this.handleNavigation(scannedData, identifier, dailcode, matchedDeeplinkConfig, attributeConfig.params['attributes'], urlMatch.groups); + } + private async handleNavigation(payloadUrl, identifier, dialCode, matchedDeeplinkConfig, attributeList, urlMatchGroup) { + const route = matchedDeeplinkConfig.route; + let extras = {}; + const request = this.getRequest(payloadUrl, matchedDeeplinkConfig, attributeList); + if (request && (request.query || request.filters && Object.keys(request.filters).length)) { + extras = { + state: { + source: PageId.SPLASH_SCREEN, + preAppliedFilter: { + query: request.query || '', + filters: { + status: ['Live'], + objectType: ['Content'], + ...request.filters + } + } + } + }; + } else if (matchedDeeplinkConfig && + matchedDeeplinkConfig.pattern && matchedDeeplinkConfig.pattern.includes('manage-learn')) { + extras = { + state: { + data: urlMatchGroup + } + }; + } + this.setTabsRoot(); + this.navCtrl.navigateForward([route], extras); + this.closeProgressLoader(); + } + async navigateContent( + identifier, isFromLink = false, content?: Content | null, + payloadUrl?: string, route?: string, coreRelationList?: Array + ) { + try { + this.appGlobalService.resetSavedQuizContent(); + if (content) { + if (!route) { + route = this.getRouterPath(content); + } + this.setTabsRoot(); + await this.router.navigate([route], + { + state: { + content, + corRelation: this.getCorrelationList(payloadUrl, coreRelationList) + } + }); + } else { + if (!this.commonUtilService.networkInfo.isNetworkAvailable) { + this.commonUtilService.showToast('NEED_INTERNET_FOR_DEEPLINK_CONTENT'); + this.appGlobalService.skipCoachScreenForDeeplink = false; + this.closeProgressLoader(); + return; + } + } + } catch (err) { + this.closeProgressLoader(); + console.log(err); + } + } + private closeProgressLoader() { + this.sbProgressLoader.hide({ + id: this.progressLoaderId + }); + this.progressLoaderId = undefined; + } + private getRequest(payloadUrl: string, matchedDeeplinkConfig, attributeList) { + if (!matchedDeeplinkConfig.params || !Object.keys(matchedDeeplinkConfig.params).length) { + return undefined; + } + + const url = new URL(payloadUrl); + const request: { + query?: string; + filters?: {}; + } = {}; + const filters = this.getDefaultFilter(matchedDeeplinkConfig.params); + const queryParamFilters = {}; + const urlAttributeList = []; + request.query = url.searchParams.get(matchedDeeplinkConfig.params.key) || ''; + if (url.searchParams.has('se_mediums')) { + url.searchParams.set('medium', url.searchParams.get('se_mediums')); + } + if (url.searchParams.has('se_boards')) { + url.searchParams.set('board', url.searchParams.get('se_boards')); + } + if (url.searchParams.has('se_gradeLevels')) { + url.searchParams.set('gradeLevel', url.searchParams.get('se_gradeLevels')); + } + if (url.searchParams.has('se_subjects')) { + url.searchParams.set('subject', url.searchParams.get('se_subjects')); + } + url.searchParams.forEach((value, key) => { + urlAttributeList.push(key); + }); + + attributeList = attributeList.filter((attribute) => urlAttributeList.indexOf(attribute.code) >= 0 + || urlAttributeList.indexOf(attribute.proxyCode) >= 0); + attributeList.forEach((attribute) => { + let values ; + if (attribute.type === 'Array') { + values = url.searchParams.getAll(attribute.proxyCode ? attribute.proxyCode : attribute.code); + } else if (attribute.type === 'String') { + values = url.searchParams.get(attribute.proxyCode ? attribute.proxyCode : attribute.code); + } + + if (values && values.length) { + if (attribute.filter === 'custom') { + queryParamFilters[attribute.code] = + this.getCustomFilterValues(matchedDeeplinkConfig.params, values, attribute); + } else { + queryParamFilters[attribute.code] = values; + } + } + }); + request.filters = { ...filters, ...queryParamFilters }; + return request; + } + private getDefaultFilter(deeplinkParams) { + if (!deeplinkParams || !deeplinkParams.data || !deeplinkParams.data.length) { + return {}; + } + const defaultFilter = deeplinkParams.data.filter((param) => param.type === 'default'); + return defaultFilter.reduce((acc, item) => { + acc[item.code] = item.values; + return acc; + }, {}); + } + + private getCustomFilterValues(deeplinkParams, values, attribute) { + if (!deeplinkParams || !deeplinkParams.data || !deeplinkParams.data.length) { + return []; + } + const customFilterData = deeplinkParams.data.find((param) => param.type === 'custom' && param.code === attribute.code); + let customFilterOptions = []; + if (customFilterData && customFilterData.values) { + values.forEach((v) => { + const customFilterValues = customFilterData.values.find(m => m.name === v); + customFilterOptions = customFilterOptions.concat(customFilterValues ? customFilterValues.options : []); + }); + } + return customFilterOptions; + } + private getCorrelationList(payloadUrl, corRelation?: Array) { + if (!corRelation) { + corRelation = []; + } + if (payloadUrl) { + corRelation.push({ + id: ContentUtil.extractBaseUrl(payloadUrl), + type: CorReleationDataType.SOURCE + }); + } + return corRelation; + } + private setTabsRoot() { + if (this.enableRootNavigation) { + try { + // this.location.replaceState(this.router.serializeUrl(this.router.createUrlTree([RouterLinks.TABS]))); + } catch (e) { + console.log(e); + } + this.enableRootNavigation = false; + } + } + private getRouterPath(content) { + let route; + if (content.primaryCategory === CsPrimaryCategory.COURSE.toLowerCase()) { + route = RouterLinks.ENROLLED_COURSE_DETAILS; + } else if (content.mimeType === MimeType.COLLECTION) { + route = RouterLinks.COLLECTION_DETAIL_ETB; + } else { + route = RouterLinks.CONTENT_DETAILS; + } + return route; + } +} \ No newline at end of file diff --git a/src/services/sunbirdqrscanner.service.ts b/src/services/sunbirdqrscanner.service.ts index 4fc2f817f..da2e9aa78 100644 --- a/src/services/sunbirdqrscanner.service.ts +++ b/src/services/sunbirdqrscanner.service.ts @@ -265,7 +265,7 @@ private getProfileSettingConfig() { } else if (scannedData.includes('/certs/')) { this.qrScannerResultHandler.handleCertsQR(source, scannedData); } else if(scannedData.includes('/manage-learn/')) { - alert("in manage learn") + this.qrScannerResultHandler.manageLearScan(scannedData); }else { this.qrScannerResultHandler.handleInvalidQRCode(source, scannedData); this.showInvalidCodeAlert(scannedData); From a3fe61b30445af49c6311a4ec8dd40774c44ccab Mon Sep 17 00:00:00 2001 From: Vishwa suresh Date: Tue, 21 Dec 2021 20:39:44 +0530 Subject: [PATCH 2/4] Issue #SB-28022 feat : QR Code Capability --- src/app/manage-learn/core/guards/ml.guard.ts | 4 +- src/assets/i18n/en.json | 4 +- src/services/qrscanresulthandler.service.ts | 221 +++---------------- src/services/sunbirdqrscanner.service.ts | 2 - 4 files changed, 35 insertions(+), 196 deletions(-) diff --git a/src/app/manage-learn/core/guards/ml.guard.ts b/src/app/manage-learn/core/guards/ml.guard.ts index 66fa3967b..1c056f91b 100644 --- a/src/app/manage-learn/core/guards/ml.guard.ts +++ b/src/app/manage-learn/core/guards/ml.guard.ts @@ -21,11 +21,11 @@ export class MlGuard implements CanActivate { if (data.role) { resolve(true) } else { - this.toast.showMessage("You do not have access. Please update you profile", 'danger'); + this.toast.showMessage("You do not have access. Please update your profile", 'danger'); resolve(false); } }).catch(error => { - this.toast.showMessage("You do not have access.Please update you profile", 'danger'); + this.toast.showMessage("You do not have access.Please update your profile", 'danger'); resolve(false) }) } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 85cb73e96..570c3ead1 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1507,5 +1507,7 @@ "FRMELEMNTS_LBL_EARNMCERT" : "Certificate will be issued if you score above {{percent}}% in your assessments", "FRMELEMNTS_LBL_EARNYOURCERT" : "Completion certificate will be issued upon 100% completion", "FRMELEMNTS_MSG_INVALID_LINK":"Invalid Link, please try with other link", - "FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND":"Template details not found" + "FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND":"Template details not found", + "FRMELEMNTS_MSG_CONTENT_NOT_AVAILABLE_FOR_ROLE":"This content is not available for your Role", + "FRMELEMNTS_MSG_PLEASE_LOGIN_HT_OTHER":"Please login as HT & Other Officials to access this content" } diff --git a/src/services/qrscanresulthandler.service.ts b/src/services/qrscanresulthandler.service.ts index 9b85e3eb5..59478f5ce 100644 --- a/src/services/qrscanresulthandler.service.ts +++ b/src/services/qrscanresulthandler.service.ts @@ -9,8 +9,9 @@ import { CorrelationData, TelemetryObject, TelemetryService, + SharedPreferences, } from 'sunbird-sdk'; -import { EventTopics, RouterLinks,MimeType } from '../app/app.constant'; +import { EventTopics, RouterLinks,MimeType,PreferenceKey } from '../app/app.constant'; import { CommonUtilService } from './common-util.service'; import { @@ -33,8 +34,7 @@ import { ContentUtil } from '@app/util/content-util'; import * as qs from 'qs'; import { NavigationService } from './navigation-handler.service'; import { FormConstants } from '@app/app/form.constants'; -import { SbProgressLoader, Context as SbProgressLoaderContext } from './sb-progress-loader.service'; -import { CsPrimaryCategory } from '@project-sunbird/client-services/services/content'; +import { SbProgressLoader } from './sb-progress-loader.service'; declare var cordova; @@ -46,11 +46,14 @@ export class QRScannerResultHandler { scannedUrlMap: object; private progressLoaderId: string; private enableRootNavigation = false; + selectedUserType?: any; + guestUser: boolean = false; constructor( @Inject('CONTENT_SERVICE') private contentService: ContentService, @Inject('TELEMETRY_SERVICE') private telemetryService: TelemetryService, @Inject('PAGE_ASSEMBLE_SERVICE') private pageAssembleService: PageAssembleService, @Inject('FRAMEWORK_SERVICE') private frameworkService: FrameworkService, + @Inject('SHARED_PREFERENCES') private preferences: SharedPreferences, private commonUtilService: CommonUtilService, private telemetryGeneratorService: TelemetryGeneratorService, private router: Router, @@ -306,22 +309,30 @@ export class QRScannerResultHandler { corRelationList); } - // Lesser the value higher the priority - private validateDeeplinkPriority(matchedDeeplinkConfig, config) { - return (matchedDeeplinkConfig && !matchedDeeplinkConfig.priority && config.priority) || - (matchedDeeplinkConfig && matchedDeeplinkConfig.priority - && config.priority && matchedDeeplinkConfig.priority > config.priority); + async manageLearScan(scannedData) { + this.selectedUserType = await this.preferences.getString(PreferenceKey.SELECTED_USER_TYPE).toPromise(); + if (!this.appGlobalService.isUserLoggedIn()) { + this.commonUtilService.showToast("FRMELEMNTS_MSG_PLEASE_LOGIN_HT_OTHER"); + return; + } + if (scannedData.includes('/create-project/') && this.selectedUserType == "administrator") { + this.navigateHandler(scannedData); + return; + } else if ((scannedData.includes('/create-observation/')) && (this.selectedUserType == "administrator" || this.selectedUserType == "teacher")) { + this.navigateHandler(scannedData); + return; + } else { + this.commonUtilService.showToast('FRMELEMNTS_MSG_CONTENT_NOT_AVAILABLE_FOR_ROLE'); + } } - - async manageLearScan(scannedData){ - const dailcode = await this.parseDialCode(scannedData); + async navigateHandler(scannedData) { const deepLinkUrlConfig: { name: string, code: string, pattern: string, route: string, priority?: number, params?: {} }[] = - await this.formFrameWorkUtilService.getFormFields(FormConstants.DEEPLINK_CONFIG); + await this.formFrameWorkUtilService.getFormFields(FormConstants.DEEPLINK_CONFIG); let matchedDeeplinkConfig: { name: string, code: string, pattern: string, route: string, priority?: number } = null; let urlMatch; deepLinkUrlConfig.forEach(config => { const urlRegexMatch = scannedData.match(new RegExp(config.pattern)); - if (!!urlRegexMatch && (!matchedDeeplinkConfig || this.validateDeeplinkPriority(matchedDeeplinkConfig, config))) { + if (!!urlRegexMatch && (!matchedDeeplinkConfig)) { if (config.code === 'profile' && !this.appGlobalService.isUserLoggedIn()) { config.route = 'tabs/guest-profile'; } @@ -329,7 +340,6 @@ export class QRScannerResultHandler { urlMatch = urlRegexMatch; } }); - if (!matchedDeeplinkConfig) { return; } @@ -337,184 +347,13 @@ export class QRScannerResultHandler { if (urlMatch && urlMatch.groups && Object.keys(urlMatch.groups).length) { identifier = urlMatch.groups.quizId || urlMatch.groups.content_id || urlMatch.groups.course_id; } - const attributeConfig = deepLinkUrlConfig.find(config => config.code === 'attributes'); - this.handleNavigation(scannedData, identifier, dailcode, matchedDeeplinkConfig, attributeConfig.params['attributes'], urlMatch.groups); - } - private async handleNavigation(payloadUrl, identifier, dialCode, matchedDeeplinkConfig, attributeList, urlMatchGroup) { + let extras = {}; const route = matchedDeeplinkConfig.route; - let extras = {}; - const request = this.getRequest(payloadUrl, matchedDeeplinkConfig, attributeList); - if (request && (request.query || request.filters && Object.keys(request.filters).length)) { - extras = { - state: { - source: PageId.SPLASH_SCREEN, - preAppliedFilter: { - query: request.query || '', - filters: { - status: ['Live'], - objectType: ['Content'], - ...request.filters - } - } - } - }; - } else if (matchedDeeplinkConfig && - matchedDeeplinkConfig.pattern && matchedDeeplinkConfig.pattern.includes('manage-learn')) { - extras = { - state: { - data: urlMatchGroup - } - }; - } - this.setTabsRoot(); - this.navCtrl.navigateForward([route], extras); - this.closeProgressLoader(); - } - async navigateContent( - identifier, isFromLink = false, content?: Content | null, - payloadUrl?: string, route?: string, coreRelationList?: Array - ) { - try { - this.appGlobalService.resetSavedQuizContent(); - if (content) { - if (!route) { - route = this.getRouterPath(content); - } - this.setTabsRoot(); - await this.router.navigate([route], - { - state: { - content, - corRelation: this.getCorrelationList(payloadUrl, coreRelationList) - } - }); - } else { - if (!this.commonUtilService.networkInfo.isNetworkAvailable) { - this.commonUtilService.showToast('NEED_INTERNET_FOR_DEEPLINK_CONTENT'); - this.appGlobalService.skipCoachScreenForDeeplink = false; - this.closeProgressLoader(); - return; - } - } - } catch (err) { - this.closeProgressLoader(); - console.log(err); - } - } - private closeProgressLoader() { - this.sbProgressLoader.hide({ - id: this.progressLoaderId - }); - this.progressLoaderId = undefined; - } - private getRequest(payloadUrl: string, matchedDeeplinkConfig, attributeList) { - if (!matchedDeeplinkConfig.params || !Object.keys(matchedDeeplinkConfig.params).length) { - return undefined; - } - - const url = new URL(payloadUrl); - const request: { - query?: string; - filters?: {}; - } = {}; - const filters = this.getDefaultFilter(matchedDeeplinkConfig.params); - const queryParamFilters = {}; - const urlAttributeList = []; - request.query = url.searchParams.get(matchedDeeplinkConfig.params.key) || ''; - if (url.searchParams.has('se_mediums')) { - url.searchParams.set('medium', url.searchParams.get('se_mediums')); - } - if (url.searchParams.has('se_boards')) { - url.searchParams.set('board', url.searchParams.get('se_boards')); - } - if (url.searchParams.has('se_gradeLevels')) { - url.searchParams.set('gradeLevel', url.searchParams.get('se_gradeLevels')); - } - if (url.searchParams.has('se_subjects')) { - url.searchParams.set('subject', url.searchParams.get('se_subjects')); - } - url.searchParams.forEach((value, key) => { - urlAttributeList.push(key); - }); - - attributeList = attributeList.filter((attribute) => urlAttributeList.indexOf(attribute.code) >= 0 - || urlAttributeList.indexOf(attribute.proxyCode) >= 0); - attributeList.forEach((attribute) => { - let values ; - if (attribute.type === 'Array') { - values = url.searchParams.getAll(attribute.proxyCode ? attribute.proxyCode : attribute.code); - } else if (attribute.type === 'String') { - values = url.searchParams.get(attribute.proxyCode ? attribute.proxyCode : attribute.code); - } - - if (values && values.length) { - if (attribute.filter === 'custom') { - queryParamFilters[attribute.code] = - this.getCustomFilterValues(matchedDeeplinkConfig.params, values, attribute); - } else { - queryParamFilters[attribute.code] = values; - } + extras = { + state: { + data: urlMatch.groups } - }); - request.filters = { ...filters, ...queryParamFilters }; - return request; - } - private getDefaultFilter(deeplinkParams) { - if (!deeplinkParams || !deeplinkParams.data || !deeplinkParams.data.length) { - return {}; - } - const defaultFilter = deeplinkParams.data.filter((param) => param.type === 'default'); - return defaultFilter.reduce((acc, item) => { - acc[item.code] = item.values; - return acc; - }, {}); - } - - private getCustomFilterValues(deeplinkParams, values, attribute) { - if (!deeplinkParams || !deeplinkParams.data || !deeplinkParams.data.length) { - return []; - } - const customFilterData = deeplinkParams.data.find((param) => param.type === 'custom' && param.code === attribute.code); - let customFilterOptions = []; - if (customFilterData && customFilterData.values) { - values.forEach((v) => { - const customFilterValues = customFilterData.values.find(m => m.name === v); - customFilterOptions = customFilterOptions.concat(customFilterValues ? customFilterValues.options : []); - }); - } - return customFilterOptions; - } - private getCorrelationList(payloadUrl, corRelation?: Array) { - if (!corRelation) { - corRelation = []; - } - if (payloadUrl) { - corRelation.push({ - id: ContentUtil.extractBaseUrl(payloadUrl), - type: CorReleationDataType.SOURCE - }); - } - return corRelation; + }; + this.navCtrl.navigateForward([route], extras); } - private setTabsRoot() { - if (this.enableRootNavigation) { - try { - // this.location.replaceState(this.router.serializeUrl(this.router.createUrlTree([RouterLinks.TABS]))); - } catch (e) { - console.log(e); - } - this.enableRootNavigation = false; - } - } - private getRouterPath(content) { - let route; - if (content.primaryCategory === CsPrimaryCategory.COURSE.toLowerCase()) { - route = RouterLinks.ENROLLED_COURSE_DETAILS; - } else if (content.mimeType === MimeType.COLLECTION) { - route = RouterLinks.COLLECTION_DETAIL_ETB; - } else { - route = RouterLinks.CONTENT_DETAILS; - } - return route; - } } \ No newline at end of file diff --git a/src/services/sunbirdqrscanner.service.ts b/src/services/sunbirdqrscanner.service.ts index da2e9aa78..2db117f5a 100644 --- a/src/services/sunbirdqrscanner.service.ts +++ b/src/services/sunbirdqrscanner.service.ts @@ -212,8 +212,6 @@ private getProfileSettingConfig() { return new Promise((resolve, reject) => { (window as any).qrScanner.startScanner(screenTitle, displayText, displayTextColor, buttonText, showButton, this.platform.isRTL, async (scannedData) => { - alert("scanned") - alert(JSON.stringify(scannedData)) if (scannedData === 'skip') { if (this.appGlobalService.DISPLAY_ONBOARDING_CATEGORY_PAGE) { this.stopScanner(); From d98d02c7ea87832caf57c922500f89f212e5d5b4 Mon Sep 17 00:00:00 2001 From: Vishwa suresh Date: Thu, 23 Dec 2021 16:31:42 +0530 Subject: [PATCH 3/4] Issue #SB-27808 fix:TEACH tool - Preview issue --- .../submission-preview-page.component.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html b/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html index 8aca4c00c..e487249e3 100644 --- a/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html +++ b/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html @@ -29,7 +29,7 @@

Q{{ i + 1 }}. {{ question?.question[0] }}

question?.responseType === 'matrix' && question?.responseType !== 'pageQuestions' && question?.value " > -

Q{{ i + 1 }}. {{ question?.question[0] }}

+
{{ question?.instanceIdentifier }} {{ j + 1 }}
@@ -52,12 +52,11 @@

Q{{ k + 1 }}. {{ answer?.question[0] }}

-

Q{{ i + 1 }}. {{ question?.question[0] }}

- +
-

Q{{ i + 1 }}. {{ answer?.question[0] }}

+
{{ answer?.instanceIdentifier }} {{ j + 1 }}
From 834121f7babae3f26fdb9f6f23099ca14f390149 Mon Sep 17 00:00:00 2001 From: Vishwa suresh Date: Fri, 7 Jan 2022 14:00:58 +0530 Subject: [PATCH 4/4] Issue #SB-27808 fix : Extra Q1 removed from submission preview --- .../project/project-template/project-template.page.ts | 5 +++-- .../submission-preview-page.component.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/manage-learn/project/project-template/project-template.page.ts b/src/app/manage-learn/project/project-template/project-template.page.ts index 3f145edea..97b124d11 100644 --- a/src/app/manage-learn/project/project-template/project-template.page.ts +++ b/src/app/manage-learn/project/project-template/project-template.page.ts @@ -188,8 +188,7 @@ export class ProjectTemplatePage { } catch (error) { console.log(error); } - - if (resp && resp.result) { + if (resp && resp.result && resp.result._id) { this.router .navigate([`/${RouterLinks.PROJECT}`], { queryParams: { @@ -205,6 +204,8 @@ export class ProjectTemplatePage { }, }); }); + }else{ + this.toast.showMessage(resp?.message,'danger'); } } } diff --git a/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html b/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html index e487249e3..7aac7b502 100644 --- a/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html +++ b/src/app/manage-learn/submission-preview/submission-preview-page/submission-preview-page.component.html @@ -56,7 +56,7 @@

Q{{ k + 1 }}. {{ answer?.question[0] }}

- +

Q{{ i + 1 }}. {{ answer?.question[0] }}

{{ answer?.instanceIdentifier }} {{ j + 1 }}